/* Staff Manager Stylesheet - Matches Screenshots and Design System */

:root {
    --sm-bg-body: #0a0b10;
    --sm-bg-card: #12131d;
    --sm-bg-hover: #181a28;
    --sm-bg-active: #1f2235;
    --sm-border: rgba(255, 255, 255, 0.08);
    --sm-border-focus: rgba(129, 140, 248, 0.5);
    --sm-purple-dim: rgba(99, 102, 241, 0.15);
    --sm-purple-border: rgba(99, 102, 241, 0.35);
    --sm-purple-text: #a5b4fc;
    --sm-purple-accent: #6366f1;
    --sm-green: #22c55e;
    --sm-green-dim: rgba(34, 197, 94, 0.12);
    --sm-green-border: rgba(34, 197, 94, 0.3);
    --sm-yellow: #eab308;
    --sm-yellow-dim: rgba(234, 179, 8, 0.12);
    --sm-yellow-border: rgba(234, 179, 8, 0.3);
    --sm-red: #ef4444;
    --sm-red-dim: rgba(239, 68, 68, 0.12);
    --sm-red-border: rgba(239, 68, 68, 0.3);
}

/* Bot Switcher in Header */
.bot-mode-switcher {
    display: inline-flex;
    align-items: center;
    background: rgba(18, 19, 29, 0.85);
    border: 1px solid var(--sm-border);
    border-radius: 9999px;
    padding: 3px;
    gap: 2px;
    backdrop-filter: blur(10px);
}

.bot-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
}

.bot-mode-btn:hover {
    color: #f8fafc;
}

.bot-mode-btn.active {
    background: var(--sm-purple-accent);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.bot-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
}

.bot-mode-btn.active .bot-dot {
    background: #ffffff;
}

/* Staff Table - Screenshot 1 */
.staff-table-container {
    background: var(--sm-bg-card);
    border: 1px solid var(--sm-border);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.staff-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.staff-table th {
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid var(--sm-border);
    background: rgba(18, 19, 29, 0.5);
    user-select: none;
}

.staff-table th.sortable {
    cursor: pointer;
}

.staff-table th.sortable:hover {
    color: #cbd5e1;
}

.staff-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--sm-border);
    vertical-align: middle;
    font-size: 14px;
}

.staff-table tr:last-child td {
    border-bottom: none;
}

.staff-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Member Column */
.staff-member-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.staff-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #1e1f2f;
    border: 1px solid var(--sm-border);
}

.staff-member-info {
    display: flex;
    flex-direction: column;
}

.staff-display-name {
    font-weight: 600;
    color: #f8fafc;
    font-size: 14px;
    line-height: 1.2;
}

.staff-username {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

/* Badge Pills */
.rank-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    background: var(--sm-purple-dim);
    border: 1px solid var(--sm-purple-border);
    color: var(--sm-purple-text);
    white-space: nowrap;
}

.panel-role-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(88, 101, 242, 0.12);
    border: 1px solid rgba(88, 101, 242, 0.35);
    color: #a5b4fc;
    white-space: nowrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pill.active {
    background: var(--sm-green-dim);
    border: 1px solid var(--sm-green-border);
    color: #4ade80;
}
.status-pill.active::before {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.status-pill.on_leave, .status-pill.on-leave {
    background: var(--sm-yellow-dim);
    border: 1px solid var(--sm-yellow-border);
    color: #facc15;
}
.status-pill.on_leave::before, .status-pill.on-leave::before {
    background: #eab308;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

.status-pill.blacklisted {
    background: var(--sm-red-dim);
    border: 1px solid var(--sm-red-border);
    color: #f87171;
}
.status-pill.blacklisted::before {
    background: #ef4444;
}

/* Ranks & Permissions View - Screenshot 2 */
.ranks-manager-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    margin-top: 16px;
}

@media (max-width: 900px) {
    .ranks-manager-container {
        grid-template-columns: 1fr;
    }
}

.ranks-list-card {
    background: var(--sm-bg-card);
    border: 1px solid var(--sm-border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ranks-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 14px;
    border-bottom: 1px solid var(--sm-border);
}

.ranks-list-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
    position: relative;
    user-select: none;
}

.rank-item:hover {
    background: var(--sm-bg-hover);
}

.rank-item.active {
    background: var(--sm-bg-active);
}

.rank-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sm-purple-accent);
}

.rank-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #818cf8;
    flex-shrink: 0;
}

.rank-item-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rank-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-item-members {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

/* Permissions Panel (Right Column) */
.permissions-card {
    background: var(--sm-bg-card);
    border: 1px solid var(--sm-border);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.permissions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--sm-border);
    margin-bottom: 20px;
}

.permissions-title-group h3 {
    margin: 0;
    font-size: 18px;
    color: #f8fafc;
}

.permissions-title-group p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #64748b;
}

.permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.permission-row:last-child {
    border-bottom: none;
}

.permission-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.permission-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}

.permission-desc {
    font-size: 12px;
    color: #64748b;
}

/* iOS-style toggle switch - Matching Screenshot 2 */
.sm-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.sm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #27273a;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sm-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.sm-switch input:checked + .sm-slider {
    background-color: var(--sm-purple-accent);
    border-color: var(--sm-purple-accent);
}

.sm-switch input:checked + .sm-slider:before {
    transform: translateX(20px);
}

/* Quick Action Buttons */
.action-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.sm-btn-primary {
    background: var(--sm-purple-accent);
    color: #ffffff;
}

.sm-btn-primary:hover {
    background: #4f46e5;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.sm-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--sm-border);
    color: #e2e8f0;
}

.sm-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sm-btn-danger {
    background: var(--sm-red-dim);
    border-color: var(--sm-red-border);
    color: #f87171;
}

.sm-btn-danger:hover {
    background: #ef4444;
    color: #ffffff;
}

.sm-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Warnings Indicator Badge */
.warnings-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.warnings-badge.clean {
    color: #64748b;
}

.warnings-badge.warn-1 {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.warnings-badge.warn-2 {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.warnings-badge.warn-3 {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: pulseWarn 2s infinite;
}

@keyframes pulseWarn {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Modal Windows */
.sm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.sm-modal {
    background: var(--sm-bg-card);
    border: 1px solid var(--sm-border);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.sm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--sm-border);
}

.sm-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
}

.sm-modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
}

.sm-modal-close:hover {
    color: #f1f5f9;
}

.sm-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--sm-border);
    background: rgba(0, 0, 0, 0.15);
}

.sm-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sm-form-label {
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
}

.sm-form-label .required {
    color: #ef4444;
}

.sm-form-control {
    background: #0f1019;
    border: 1px solid var(--sm-border);
    border-radius: 8px;
    padding: 10px 14px;
    color: #f8fafc;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.sm-form-control:focus {
    border-color: var(--sm-purple-accent);
}

textarea.sm-form-control {
    min-height: 80px;
    resize: vertical;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

/* Sidebar Overlay & Mobile Drawer Responsiveness */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    z-index: 95;
    transition: opacity 0.3s ease;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

.menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.6);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw;
    }

    .menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 10px 14px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .content-area {
        padding: 14px;
    }

    .header-actions {
        gap: 6px;
    }

    .lang-switch button span {
        display: none;
    }

    .bot-mode-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .staff-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .staff-table {
        min-width: 620px;
    }

    .staff-table th,
    .staff-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .staff-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .ranks-layout {
        flex-direction: column !important;
        gap: 16px;
    }

    .ranks-sidebar {
        width: 100% !important;
        max-width: 100% !important;
    }

    .ranks-details {
        width: 100% !important;
    }

    .sm-modal {
        max-width: 95vw;
        margin: 10px;
    }

    .settings-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .staff-stats-grid {
        grid-template-columns: 1fr;
    }

    .main-header {
        padding: 8px 10px;
    }

    .bot-mode-switcher {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }

    .sm-modal-body {
        padding: 16px;
    }

    .sm-modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
        width: 100%;
    }

    .sm-modal-footer button {
        width: 100%;
    }
}

/* Full-width Responsive Settings */
.settings-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.settings-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--sm-border);
    background: rgba(18, 19, 29, 0.4);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.settings-table-wrapper .staff-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.settings-table-wrapper .staff-table th,
.settings-table-wrapper .staff-table td {
    padding: 10px 14px;
    vertical-align: middle;
}

.settings-table-wrapper .staff-table td input[type="text"],
.settings-table-wrapper .staff-table td input[type="number"],
.settings-table-wrapper .staff-table td select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
