/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS FRAMEWORK - DESKTOP APP SETTINGS SCREEN (TPL-SET-04)
   1:1 Reference from AX-Digital-Marketing Desktop Home Settings Screen
   Pixel-Perfect Discord Desktop Layout Sync with Categorized Sidebar,
   Sub-tabs, Maskable Fields, and ESC Close Button.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    --app-set-bg-content: #2b2d31;
    --app-set-bg-sidebar: #1e1f22;
    --app-set-bg-card: #232428;
    --app-set-bg-item: #111214;
    --app-set-bg-hover: rgba(255, 255, 255, 0.05);
    --app-set-bg-active: rgba(255, 255, 255, 0.1);
    
    --app-set-text-primary: #ffffff;
    --app-set-text-normal: #dbdee1;
    --app-set-text-muted: #949ba4;
    --app-set-text-subtext: #b5bac1;
    
    --app-set-accent: #5865f2;
    --app-set-accent-hover: #4752c4;
    --app-set-success: #23a55a;
    --app-set-danger: #f23f42;
    --app-set-link: #00a8fc;
    
    --app-set-border: rgba(255, 255, 255, 0.06);
    --app-set-btn-gray: #4e5058;
    --app-set-btn-gray-hover: #6d6f78;
}

/* ── STUDIO WRAPPER ──────────────────────────────────────────────────────── */
.app-settings-desktop-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #18191c;
    font-family: 'Whitney', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--app-set-text-normal);
}

.app-settings-desktop-toolbar {
    height: 48px;
    background: #141517;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 20;
    flex-shrink: 0;
}

.app-settings-desktop-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.app-settings-desktop-tag {
    font-size: 11px;
    font-family: monospace;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.app-settings-desktop-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-settings-desktop-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.app-settings-desktop-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.app-settings-desktop-btn-primary {
    background: var(--app-set-accent);
    border-color: var(--app-set-accent);
}

.app-settings-desktop-btn-primary:hover {
    background: var(--app-set-accent-hover);
    border-color: var(--app-set-accent-hover);
}

/* ── MAIN SETTINGS SCREEN CONTAINER ──────────────────────────────────────── */
.app-settings-main-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    height: calc(100% - 48px);
    overflow: hidden;
    position: relative;
    background: var(--app-set-bg-content);
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.app-prefs-sidebar {
    width: 260px;
    background: var(--app-set-bg-sidebar);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 10px 20px 20px;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--app-set-border);
    user-select: none;
}

.app-prefs-sidebar::-webkit-scrollbar {
    width: 4px;
}
.app-prefs-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

/* Sidebar User Profile Card */
.app-prefs-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s ease;
}

.app-prefs-sidebar-profile:hover {
    background: rgba(255, 255, 255, 0.06);
}

.app-prefs-sidebar-profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #5c6fb1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.app-prefs-sidebar-profile-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.app-prefs-sidebar-profile-name {
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-prefs-sidebar-profile-link {
    color: var(--app-set-text-subtext);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-prefs-sidebar-chevron {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-set-text-subtext);
    font-size: 10px;
}

/* Sidebar Search */
.app-prefs-sidebar-search {
    margin: 8px 6px 14px 6px;
    position: relative;
}

.app-prefs-sidebar-search input {
    width: 100%;
    background: #111214;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    border-radius: 4px;
    color: #dbdee1;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.app-prefs-sidebar-search input:focus {
    border-color: var(--app-set-accent);
}

.app-prefs-sidebar-search input::placeholder {
    color: #949ba4;
}

/* Category Headers & Nav Items */
.app-prefs-sidebar-header {
    color: var(--app-set-text-muted);
    font-size: 11px;
    line-height: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 16px 0 6px 8px;
}

.app-prefs-nav-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--app-set-text-muted);
    font-size: 14.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.1s, color 0.1s;
}

.app-prefs-nav-item:hover {
    background: var(--app-set-bg-hover);
    color: var(--app-set-text-normal);
}

.app-prefs-nav-item.active {
    background: var(--app-set-bg-active);
    color: #ffffff;
    font-weight: 600;
}

.app-prefs-divider {
    height: 1px;
    background: var(--app-set-border);
    margin: 12px 8px;
}

/* ── CONTENT AREA ────────────────────────────────────────────────────────── */
.app-prefs-content {
    flex: 1;
    height: 100%;
    background: var(--app-set-bg-content);
    padding: 36px 48px 80px 48px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
}

.app-prefs-content::-webkit-scrollbar {
    width: 10px;
}
.app-prefs-content::-webkit-scrollbar-track {
    background: var(--app-set-bg-content);
}
.app-prefs-content::-webkit-scrollbar-thumb {
    background-color: #1e1f22;
    border-radius: 10px;
    border: 2px solid var(--app-set-bg-content);
}
.app-prefs-content::-webkit-scrollbar-thumb:hover {
    background-color: #141517;
}

/* ── DISCORD ESC CLOSE BUTTON ────────────────────────────────────────────── */
.app-prefs-close-btn {
    position: absolute;
    top: 36px;
    right: 48px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #b5bac1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #b5bac1;
    transition: all 0.15s ease;
    z-index: 50;
    user-select: none;
}

.app-prefs-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: #ffffff;
    transform: scale(1.05);
}

.app-prefs-close-icon {
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
}

.app-prefs-close-btn span {
    font-size: 9px;
    font-weight: 700;
    margin-top: 1px;
    letter-spacing: 0.5px;
}

/* ── CONTENT HEADERS & SUB-TABS ─────────────────────────────────────────── */
.app-prefs-content-header h2 {
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 16px 0;
    letter-spacing: -0.01em;
}

.app-prefs-content-header h3 {
    font-size: 17px;
    line-height: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 16px 0;
}

.app-prefs-sub-tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--app-set-border);
    margin: 16px 0 24px 0;
}

.app-prefs-sub-tab {
    padding-bottom: 10px;
    color: var(--app-set-text-subtext);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: color 0.15s;
}

.app-prefs-sub-tab:hover {
    color: var(--app-set-text-normal);
}

.app-prefs-sub-tab.active {
    color: #ffffff;
}

.app-prefs-sub-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--app-set-accent);
}

/* ── ACCOUNT CARD ────────────────────────────────────────────────────────── */
.app-prefs-account-card {
    background: #1e1f22;
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.app-prefs-account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.app-prefs-account-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.app-prefs-account-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-prefs-account-item-label {
    text-transform: uppercase;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--app-set-text-subtext);
    letter-spacing: 0.03em;
}

.app-prefs-account-item-value {
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 500;
}

.app-prefs-account-item-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.app-prefs-reveal-link {
    color: var(--app-set-link);
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    margin-top: 2px;
}

.app-prefs-reveal-link:hover {
    text-decoration: underline;
}

.app-prefs-edit-btn {
    background: var(--app-set-btn-gray);
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease;
}

.app-prefs-edit-btn:hover {
    background: var(--app-set-btn-gray-hover);
}

/* ── MFA BANNER ──────────────────────────────────────────────────────────── */
.app-prefs-mfa-banner {
    background: rgba(35, 165, 90, 0.1);
    border: 1px solid rgba(35, 165, 90, 0.3);
    border-radius: 6px;
    padding: 14px 18px;
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-prefs-mfa-icon {
    color: #23a55a;
    font-size: 18px;
    display: flex;
    align-items: center;
}

.app-prefs-mfa-text {
    color: #dbdee1;
    font-size: 14px;
    font-weight: 500;
}

/* ── SWITCHES & GENERIC ROWS ─────────────────────────────────────────────── */
.app-prefs-field {
    background: var(--app-set-bg-card);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--app-set-border);
}

.app-prefs-switch {
    width: 42px;
    height: 24px;
    background: #4e5058;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.app-prefs-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.app-prefs-switch.active {
    background: var(--app-set-success);
}

.app-prefs-switch.active::after {
    transform: translateX(18px);
}

/* ── DISMISS BANNER ──────────────────────────────────────────────────────── */
.app-settings-dismiss-banner {
    display: none;
    position: absolute;
    inset: 48px 0 0 0;
    background: rgba(20, 21, 24, 0.95);
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 20px;
}

.app-settings-dismiss-banner.active {
    display: flex;
}
