/* ============================================================
   ADMIN PANEL V3 - Dark Minimal Style (Fixed Layout)
   Pure black + white accents design with proper grid
   ============================================================ */

/* ==================== ROOT VARIABLES ==================== */
:root {
    --admin-bg: #000000;
    --admin-sidebar: #0a0a0a;
    --admin-card: #111111;
    --admin-border: #222222;
    --admin-text: #ffffff;
    --admin-muted: #888888;
    --admin-accent: #ffffff;
    --admin-success: #22c55e;
    --admin-danger: #ef4444;
    --admin-warning: #f59e0b;
    --admin-info: #3b82f6;
    --admin-glass: rgba(255, 255, 255, 0.05);
}

/* ==================== MODAL OVERLAY ==================== */
#admin-panel-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--admin-bg);
    animation: adminFadeIn 0.3s ease-out;
}

#admin-panel-modal.active {
    display: flex;
}

@keyframes adminFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== MAIN CONTAINER ==================== */
.admin-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ==================== SIDEBAR ==================== */
.admin-sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    background: var(--admin-sidebar);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.admin-logo {
    padding: 20px 16px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.admin-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--admin-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.admin-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--admin-text);
    letter-spacing: 1px;
}

.admin-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.admin-nav-section {
    margin-bottom: 20px;
}

.admin-nav-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 12px;
    margin-bottom: 8px;
}

.admin-nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--admin-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    margin-bottom: 2px;
}

.admin-nav-btn:hover {
    background: var(--admin-glass);
    color: var(--admin-text);
}

.admin-nav-btn.active {
    background: var(--admin-accent);
    color: var(--admin-bg);
}

.admin-nav-btn .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.admin-nav-btn .nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav-btn .nav-badge {
    background: var(--admin-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ==================== MAIN CONTENT ==================== */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    background: var(--admin-bg);
    flex-shrink: 0;
    gap: 16px;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.admin-header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--admin-text);
    white-space: nowrap;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.admin-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-glass);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    color: var(--admin-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-close-btn:hover {
    background: var(--admin-danger);
    border-color: var(--admin-danger);
    color: white;
}

/* ==================== SEARCH BAR ==================== */
.admin-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 8px 12px;
    width: 280px;
    max-width: 100%;
}

.admin-search-icon {
    color: var(--admin-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.admin-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--admin-text);
    font-size: 13px;
    outline: none;
    min-width: 0;
}

.admin-search-input::placeholder {
    color: var(--admin-muted);
}

/* ==================== CONTENT AREA ==================== */
.admin-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: var(--admin-bg);
}

.admin-content::-webkit-scrollbar {
    width: 6px;
}

.admin-content::-webkit-scrollbar-track {
    background: transparent;
}

.admin-content::-webkit-scrollbar-thumb {
    background: var(--admin-border);
    border-radius: 3px;
}

/* ==================== CARDS ==================== */
.admin-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--admin-border);
    gap: 12px;
}

.admin-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--admin-text);
}

.admin-card-subtitle {
    font-size: 11px;
    color: var(--admin-muted);
    margin-top: 2px;
}

.admin-card-body {
    padding: 16px;
}

/* ==================== STATS GRID ==================== */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.admin-stat-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    padding: 16px;
}

.admin-stat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-glass);
    border-radius: 8px;
    font-size: 18px;
    margin-bottom: 10px;
}

.admin-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--admin-text);
    margin-bottom: 2px;
}

.admin-stat-label {
    font-size: 11px;
    color: var(--admin-muted);
}

/* ==================== FORM GRID ==================== */
.admin-form-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-form-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.admin-form-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.admin-form-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ==================== USER LIST ==================== */
.admin-user-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.admin-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--admin-glass);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.admin-user-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--admin-accent);
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.admin-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--admin-text);
    flex-shrink: 0;
}

.admin-user-details {
    flex: 1;
    min-width: 0;
}

.admin-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user-email {
    font-size: 11px;
    color: var(--admin-muted);
    font-family: monospace;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.admin-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid;
}

.admin-badge.online {
    background: rgba(34, 197, 94, 0.15);
    color: var(--admin-success);
    border-color: var(--admin-success);
}

.admin-badge.offline {
    background: rgba(102, 102, 102, 0.15);
    color: var(--admin-muted);
    border-color: var(--admin-muted);
}

.admin-badge.banned {
    background: rgba(239, 68, 68, 0.15);
    color: var(--admin-danger);
    border-color: var(--admin-danger);
}

.admin-badge.admin {
    background: rgba(255, 255, 255, 0.1);
    color: var(--admin-accent);
    border-color: var(--admin-accent);
}

.admin-user-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.admin-user-row:hover .admin-user-actions {
    opacity: 1;
}

/* ==================== ACTION BUTTONS ==================== */
.admin-action-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-glass);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    color: var(--admin-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-action-btn:hover {
    background: var(--admin-accent);
    border-color: var(--admin-accent);
    color: var(--admin-bg);
}

.admin-action-btn.danger:hover {
    background: var(--admin-danger);
    border-color: var(--admin-danger);
    color: white;
}

.admin-action-btn.success:hover {
    background: var(--admin-success);
    border-color: var(--admin-success);
    color: white;
}

.admin-action-btn.warning:hover {
    background: var(--admin-warning);
    border-color: var(--admin-warning);
    color: white;
}

/* ==================== BUTTONS ==================== */
.admin-btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.admin-btn-primary {
    background: var(--admin-accent);
    color: var(--admin-bg);
}

.admin-btn-primary:hover {
    background: #e5e5e5;
}

.admin-btn-danger {
    background: var(--admin-danger);
    color: white;
}

.admin-btn-danger:hover {
    background: #dc2626;
}

.admin-btn-success {
    background: var(--admin-success);
    color: white;
}

.admin-btn-success:hover {
    background: #16a34a;
}

.admin-btn-ghost {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
}

.admin-btn-ghost:hover {
    background: var(--admin-glass);
}

.admin-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==================== INPUTS ==================== */
.admin-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--admin-glass);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    color: var(--admin-text);
    font-size: 13px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.admin-input:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.admin-input::placeholder {
    color: var(--admin-muted);
}

.admin-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-input-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== COLOR PICKER ==================== */
.admin-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: var(--admin-glass);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
}

.admin-color-option {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.admin-color-option:hover {
    transform: scale(1.1);
}

.admin-color-option.selected {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 2px var(--admin-bg), 0 0 0 4px var(--admin-accent);
}

.admin-color-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.admin-color-preview {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px solid var(--admin-border);
}

/* ==================== LOADING ==================== */
.admin-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--admin-muted);
}

.admin-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--admin-border);
    border-top-color: var(--admin-accent);
    border-radius: 50%;
    animation: adminSpin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes adminSpin {
    to { transform: rotate(360deg); }
}

/* ==================== EMPTY STATE ==================== */
.admin-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--admin-muted);
}

.admin-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.admin-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--admin-text);
    margin-bottom: 6px;
}

.admin-empty-desc {
    font-size: 12px;
}

/* ==================== FLEX UTILITIES ==================== */
.admin-flex {
    display: flex;
}

.admin-flex-wrap {
    flex-wrap: wrap;
}

.admin-gap-2 {
    gap: 8px;
}

.admin-gap-3 {
    gap: 12px;
}

.admin-gap-4 {
    gap: 16px;
}

.admin-items-center {
    align-items: center;
}

.admin-justify-between {
    justify-content: space-between;
}

.admin-mb-2 {
    margin-bottom: 8px;
}

.admin-mb-3 {
    margin-bottom: 12px;
}

.admin-mb-4 {
    margin-bottom: 16px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-form-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .admin-sidebar {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    .admin-logo-text,
    .admin-nav-label,
    .admin-nav-btn .nav-text {
        display: none;
    }

    .admin-nav-btn {
        justify-content: center;
        padding: 12px;
    }

    .admin-nav-btn .nav-icon {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }

    .admin-form-grid.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-width: auto;
        max-width: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--admin-border);
    }

    .admin-nav {
        display: flex;
        flex-wrap: wrap;
        padding: 8px;
        gap: 4px;
    }

    .admin-nav-section {
        display: contents;
    }

    .admin-nav-label {
        display: none;
    }

    .admin-nav-btn {
        flex: 0 0 auto;
        padding: 10px 12px;
    }

    .admin-nav-btn .nav-text {
        display: inline;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-form-grid.cols-2,
    .admin-form-grid.cols-3,
    .admin-form-grid.cols-4 {
        grid-template-columns: 1fr;
    }

    .admin-search {
        width: 100%;
    }

    .admin-header {
        flex-wrap: wrap;
    }

    .admin-header-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* ==================== TABLE ==================== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

.admin-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    font-size: 13px;
    color: var(--admin-text);
}

.admin-table tr:hover td {
    background: var(--admin-glass);
}

/* ==================== TOGGLE ==================== */
.admin-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--admin-border);
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.admin-toggle.active {
    background: var(--admin-success);
}

.admin-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.admin-toggle.active::after {
    transform: translateX(18px);
}

/* ==================== INFO BOX ==================== */
.admin-info-box {
    padding: 12px;
    background: var(--admin-glass);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--admin-muted);
}

.admin-info-box.success {
    border-color: var(--admin-success);
    color: var(--admin-success);
}

.admin-info-box.warning {
    border-color: var(--admin-warning);
    color: var(--admin-warning);
}

.admin-info-box.danger {
    border-color: var(--admin-danger);
    color: var(--admin-danger);
}
