/* --- 1. THE OVERLAY (The Background Blur) --- */
.modal-overlay {
    display: none; /* Controlled by .active class in JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999; /* Ensure it's above everything */
    align-items: center;
    justify-content: center;
}

    .modal-overlay.active {
        display: flex;
    }

/* --- 2. THE MAIN DASHBOARD CONTAINER --- */
.modal-dashboard {
    display: flex;
    background: #ffffff;
    width: 90%;
    max-width: 900px;
    height: 80vh;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --- 3. THE SETTINGS SIDEBAR --- */
.modal-sidebar {
    width: 240px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-user {
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.mini-profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #007bff;
}

.sidebar-user span {
    font-weight: 700;
    color: #111827;
    font-size: 1rem;
}

/* Navigation Links */
.settings-nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

.nav-item {
    background: none;
    border: none;
    padding: 14px 24px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .nav-item:hover {
        background: #f3f4f6;
        color: #111827;
    }

    .nav-item.active {
        background: #eff6ff;
        color: #2563eb;
        font-weight: 600;
        border-right: 4px solid #2563eb;
    }

.close-dashboard {
    margin: 20px;
    padding: 12px;
    background: #f3f4f6;
    border: none;
    border-radius: 10px;
    color: #4b5563;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .close-dashboard:hover {
        background: #e5e7eb;
    }

/* --- 4. THE MAIN CONTENT AREA --- */
.modal-main {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    background: #ffffff;
}

.setting-section {
    display: none; /* Hidden by default */
}

    .setting-section.active {
        display: block;
        animation: sectionFade 0.3s ease-out;
    }

@keyframes sectionFade {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Typography & Elements */
.setting-section h2 {
    font-size: 1.75rem;
    color: #111827;
    margin-bottom: 24px;
}

.control-group {
    margin-bottom: 30px;
}

    .control-group label {
        display: block;
        font-weight: 600;
        color: #374151;
        margin-bottom: 10px;
    }

select, input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
}

/* --- 5. SPECIAL COMPONENTS --- */
.slider {
    -webkit-appearance: none;
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 5px;
    outline: none;
}

    .slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        background: #2563eb;
        border-radius: 50%;
        cursor: pointer;
    }

.slider-label {
    margin-top: 10px;
    font-weight: 700;
    color: #2563eb;
    font-size: 1.1rem;
}

/* Wipe Button */
.danger-btn {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

    .danger-btn:hover {
        background: #fca5a5;
        color: #ffffff;
    }

/* --- 6. MOBILE FIX --- */
@media (max-width: 768px) {
    .modal-dashboard {
        flex-direction: column;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .modal-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
    }

    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-item {
        white-space: nowrap;
        border-right: none !important;
        border-bottom: 3px solid transparent;
    }

        .nav-item.active {
            border-bottom: 3px solid #2563eb;
        }
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.auth-btn {
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s;
}

    .auth-btn:hover {
        background: #f9fafb;
    }

.license-card {
    background: #f0f7ff;
    border: 1px solid #cce3ff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

    .license-card code {
        background: #fff;
        padding: 2px 6px;
        border-radius: 4px;
        border: 1px solid #eee;
    }