/* =========================================
   ACCOUNT PAGE
   ========================================= */

#content {
    max-width: 900px;
    margin: 0 auto 60px auto;
    padding: 0 15px;
}

/* --- UNIVERSAL PANELS --- */
.account-panel {
    background-color: var(--bg-card-opaque);
    border: 1px solid var(--border-olive);
    border-radius: 12px;
    padding: 25px 20px;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
}

.panel-header {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--color-link);
    border-bottom: 1px solid var(--border-olive);
    padding-bottom: 10px;
    margin: 0 0 20px 0;
    text-align: center;
}

/* --- PROFILE PANEL --- */
.profile-panel {
    display: flex;
    flex-direction: column; /* Forces the overview and details to stack vertically */
}

.profile-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.profile-details {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-section);
    width: 100%;
}

.avatar-container {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid var(--border-olive);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-section); 
    overflow: hidden; /* Clips the square edges of the PNG into a perfect circle */
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    
    /* THE FIX: Tells the image to anchor to the top, pushing the head down into view */
    object-position: center top; 
}

.username {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vip-icon {
    font-size: 1.2rem;
    color: var(--border-focus); /* Uses your gold/yellow semantic color */
    margin: 0 5px;
}

.action-icon {
    font-size: 1.3rem;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.action-icon:hover {
    color: var(--color-link); /* Transitions smoothly to your olive accent */
    transform: scale(1.1); /* Adds a subtle interactive pop */
}

/* --- MODERN THEME TOGGLE (PILL SWITCH) --- */
.theme-switch-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 10px; /* Adds a bit of breathing room below the name */
}

.theme-switch-track {
    display: flex;
    position: relative;
    background-color: var(--bg-input-dark);
    border: 1px solid var(--border-section);
    border-radius: 30px; /* Creates the pill shape */
    padding: 4px;
    width: 180px; /* Fixed width prevents jittering during the slide */
    box-sizing: border-box;
}

.theme-switch-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 0;
    cursor: pointer;
    position: relative;
    z-index: 2; 
    
    /* THE FIX 1: Matches the sliding puck shape so the hover background stays contained */
    border-radius: 26px; 
    
    transition: color 0.3s ease, background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-switch-btn i {
    font-size: 0.95rem; 
    /* THE FIX 2: Adds smooth scaling to the icon */
    transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1), color 0.2s ease; 
}

.theme-switch-btn:hover {
    color: var(--text-main); 
    background-color: var(--bg-section-hover);
}

.theme-switch-btn:hover i {
    transform: scale(1.2); /* Pops the icon up slightly */
    color: var(--border-olive); /* Uses your accent color for extra visual feedback */
}

.theme-switch-btn:focus {
    outline: none;
}

/* --- THE SLIDING PUCK --- */
.theme-switch-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px); /* Mathematically perfect width */
    background-color: var(--bg-section);
    border: 1px solid var(--border-olive);
    border-radius: 26px;
    z-index: 1; /* Slides smoothly under the text */
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 5px var(--shadow-card);
    box-sizing: border-box;
}

/* --- ACTIVE STATES (DARK) --- */
.theme-switch-track.dark-active .dark-btn {
    color: var(--text-main);
}
.theme-switch-track.dark-active .theme-switch-slider {
    transform: translateX(0); /* Puck stays on the left */
}

/* --- ACTIVE STATES (LIGHT) --- */
.theme-switch-track.light-active .light-btn {
    color: var(--text-main);
}
.theme-switch-track.light-active .theme-switch-slider {
    transform: translateX(100%); /* Puck slides to the right */
}

/* --- PREVENT HOVER CONFLICTS ON THE ACTIVE BUTTON --- */
/* We don't want the ghost pill appearing on the button that already has the solid puck behind it */
.theme-switch-track.dark-active .dark-btn:hover,
.theme-switch-track.light-active .light-btn:hover {
    background-color: transparent; 
}

.theme-switch-track.dark-active .dark-btn:hover i,
.theme-switch-track.light-active .light-btn:hover i {
    color: inherit;
    transform: none; 
}

/* --- ADMIN CONTROLS --- */
.admin-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.05rem;
    color: var(--text-main);
    cursor: pointer;
}

.admin-toggle input {
    transform: scale(1.3);
}

/* --- FIXED DANGER LINK BUTTON (Natural Sizing) --- */
.admin-danger-link {
    display: inline-flex;
    align-items: center;
    justify-content: center; 
    
    /* THE FIX: Removed height: 38px and top: 2px. Using natural padding instead */
    padding: 6px 14px; 
    
    margin: 0;
    gap: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 600;
    line-height: 1.2; /* Slightly relaxed line-height so the text doesn't touch the borders */
    border: 1px dashed var(--border-section);
    border-radius: 6px;
    box-sizing: border-box; 
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.admin-danger-link .action-icon {
    font-size: 1.1rem; 
    color: var(--text-muted); 
    display: flex; 
    align-items: center;
    line-height: 1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.admin-danger-link:hover {
    background-color: var(--bg-alert-red); 
    color: var(--core-white); 
    border-color: var(--bg-alert-red); 
}

.admin-danger-link:hover .action-icon {
    color: var(--core-white); 
    transform: scale(1.1); 
}

/* --- REVIEW STATS --- */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.review-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-card {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background-color: var(--bg-card-glass);
    border: 1px solid var(--border-section);
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    background-color: var(--bg-section); /* Uses your structural background for a soft, native contrast shift */
    border-color: var(--border-olive);
}

.stat-name {
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
}

.stat-count {
    color: var(--color-link);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
}

/* --- USER DASHBOARD --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 2px solid var(--border-olive);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-muted);
    font-weight: 600;
}

.btn-expand {
    background: transparent;
    border: 1px solid var(--border-section);
    color: var(--text-main);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- USER DASHBOARD LAYOUT (CSS Columns Fix) --- */
.user-grid {
    column-count: 1; /* Mobile defaults to a single column */
    column-gap: 15px;
}

.user-card {
    /* Uses an opaque variable that reliably turns white in light mode */
    background-color: var(--bg-card-opaque); 
    border: 1px solid var(--border-section);
    border-radius: 8px;
    overflow: hidden;
    
    /* CRITICAL: Prevents the card from snapping in half across two columns */
    break-inside: avoid; 
    margin-bottom: 15px; 
    box-shadow: 0 4px 10px var(--shadow-card);
}

.user-card-header {
    display: flex;
    align-items: stretch;
    background-color: var(--bg-header); /* Adapts perfectly in both themes */
    border-bottom: 1px solid var(--border-section);
}

.user-id {
    background-color: var(--bg-section); /* Softer than solid black for modern UI */
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--border-section);
}

.user-name {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    flex-grow: 1;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.user-toggle {
    background-color: var(--bg-section);
    color: var(--text-main);
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-left: 1px solid var(--border-section);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.user-toggle:hover {
    background-color: var(--color-link);
    color: var(--core-bg-main);
}

/* --- USER CARD INTERNAL DETAILS --- */
.user-card-details {
    padding: 15px;
    display: none; /* Controlled by your JS */
}

/* Modern "Pill" style for data rows */
.detail-row, .users_params {
    display: flex;
    align-items: stretch;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin-bottom: 10px;
    background-color: var(--bg-input-dark); /* Clean adapting background */
    border: 1px solid var(--border-section);
    border-radius: 6px;
    overflow: hidden;
}

.detail-label, .users_params p:first-child {
    width: 105px; /* Increased from 80px */
    background-color: var(--bg-header);
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    border-right: 1px solid var(--border-section);
    display: flex;
    align-items: center;
    margin: 0;
}

.detail-value, .users_params p:last-child {
    color: var(--text-main); /* Fixes the black text bug in dark mode */
    padding: 8px 12px;
    word-break: break-all;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    margin: 0;
}

/* --- PASSWORD RESET LINK --- */
.reset-password-link {
    color: var(--color-link);
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.2s ease;
}

.reset-password-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* Privileges Management */
.card-section-title {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    display: block;
    text-align: left; /* Ensures it stays left-aligned even in the danger zone */
}

.privilege-manager, .danger-zone {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-section);
}

.addPreviliges {
    display: flex;
    align-items: stretch; /* Forces the button to perfectly match the select height */
    gap: 8px;
    margin-bottom: 15px;
}

.addPreviliges select {
    flex-grow: 1;
    background-color: var(--bg-input-dark);
    border: 1px solid var(--border-olive); /* Unified with the button border */
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    outline: none;
}

.addPreviliges select:focus {
    border-color: var(--color-link);
}

.btn-add {
    background-color: transparent;
    color: var(--color-link); 
    border: 1px solid var(--border-olive);
    padding: 0 15px; /* Removed vertical padding, relying on stretch */
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-add:hover {
    background-color: var(--bg-input-dark); /* A soft background shift rather than a solid color flip */
    border-color: var(--color-link);
}

.active-privileges {
    display: flex;
    flex-wrap: wrap; /* Allows the privileges to flow horizontally like real tags */
    gap: 8px;
}

.privilege-tag {
    background-color: var(--bg-input-dark); 
    border: 1px solid var(--border-olive); 
    border-radius: 20px; 
    
    /* CRITICAL FIXES to override the global form stretching */
    display: inline-flex; 
    width: auto; 
    flex: 0 0 auto; 
    justify-content: flex-start; 
    
    align-items: center;
    margin: 0;
}

.privilege-tag span {
    color: var(--text-main);
    padding: 5px 6px 5px 12px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-remove {
    background-color: transparent;
    color: var(--text-muted);
    border: none; /* Removed the harsh vertical divider */
    padding: 5px 12px 5px 6px;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s ease;
}

/* Hovering turns just the 'X' red, without the boxy background */
.btn-remove:hover {
    color: var(--bg-alert-red);
    background-color: transparent; 
}

.delete-form {
    display: block; 
    text-align: right;
    margin: 0; /* Margin is now handled by the danger-zone wrapper */
}

.btn-delete {
    background-color: var(--bg-alert-red);
    color: var(--core-white); 
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-delete:hover {
    opacity: 0.8; 
}

/* --- PASSWORD RESET CONTAINER & FORM --- */
.reset-panel {
    max-width: 500px;
    margin: 40px auto;
    padding: 40px;
    background-color: var(--bg-card-opaque);
    border: 1px solid var(--border-olive);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-card);
    box-sizing: border-box;
}

.reset-message {
    background-color: var(--bg-input-dark);
    border: 1px solid var(--border-section);
    color: var(--text-main);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 25px;
    text-align: center;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
}

#reset_form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.form-group {
    width: 100%;
}

#reset_form input[type="email"],
#reset_form input[type="password"] {
    width: 100%;
    background-color: var(--bg-input-dark);
    border: 1px solid var(--border-section);
    color: var(--text-main);
    padding: 12px 15px;
    font-size: 1rem;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
}

#reset_form input[type="email"]:focus,
#reset_form input[type="password"]:focus {
    border-color: var(--color-link);
}

#reset_form input.input-readonly {
    background-color: var(--bg-section);
    color: var(--text-muted);
    cursor: not-allowed;
    border-style: dashed;
}

.btn-primary {
    background-color: var(--text-main); /* Automatically pops against the card in both modes */
    color: var(--bg-body); /* Perfectly inverts the text for guaranteed legibility */
    border: none; 
    padding: 12px 20px;
    font-size: 1rem;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 2px 5px var(--shadow-hover); /* Adds a tiny bit of depth */
}

.btn-primary:hover {
    opacity: 0.85; /* A smooth, safe fade rather than a dangerous color swap */
    transform: translateY(-1px); /* Adds a tactile "lift" effect on hover */
}

/* =========================================
   DESKTOP RESPONSIVE EXCEPTIONS
   ========================================= */
@media only screen and (min-width: 769px) {
    .account-panel {
        padding: 40px;
    }
    
    .panel-header {
        text-align: left;
    }
    
    /* Shifts the avatar and name side-by-side on desktop, while details remain stacked below */
    .profile-overview {
        flex-direction: row;
        text-align: left;
        gap: 30px;
    }
    
    /* Optional: Restricts the details to a clean grid to prevent ultra-wide rows */
    .profile-details {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Puts details in two columns on desktop */
        gap: 0 15px;
    }
    
    .profile-details .card-section-title {
        grid-column: 1 / -1; /* Forces the title to span across both columns */
    }
    
    .username, .theme-switch-wrapper {
        justify-content: flex-start;
    }
    
    .admin-grid {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .admin-danger-link {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        margin-left: auto;
    }
    
    .review-grid {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .stat-card {
        flex: 1 1 calc(50% - 10px);
    }
    
    .user-grid {
        column-count: 2; 
    }
}