/* Switch Toggle CSS */
.switch {
    display: inline-block;
    height: 24px;
    /* Reduced from 34px */
    position: relative;
    width: 44px;
    /* Reduced from 60px */
}

.switch input {
    display: none !important;
}

.slider {
    background-color: var(--border-subtle);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 3px;
    content: "";
    height: 18px;
    left: 3px;
    position: absolute;
    transition: .4s;
    width: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- UTILITY --- */
.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Ensure modal respects hidden */
.modal-overlay.hidden {
    display: none !important;
}

/* Edit Profile Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    /* Default is flex, hidden class must override this */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    animation: fadeOverlay 0.3s ease;
}

@keyframes fadeOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.edit-modal-box {
    width: 90%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: slideUp 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.edit-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.edit-modal-header .close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.edit-modal-header .close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.edit-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.edit-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.edit-avatar-section img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-body);
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-change-photo {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-change-photo:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

.edit-form-group {
    margin-bottom: 24px;
}

.edit-form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.edit-input {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.edit-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(244, 42, 53, 0.15);
}

.edit-modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-save-profile {
    width: 100%;
    padding: 14px;
    border-radius: 30px;
    background: var(--text-main);
    /* White/Black Contrast */
    color: var(--bg-body);
    font-size: 1.05rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn-save-profile:hover {
    opacity: 0.9;
    transform: scale(0.99);
}

/* --- AUTH PAGE RESET to fix Broken Login --- */
.auth-container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top right, #2d0a4e 0%, #000000 60%);
    position: relative;
    /* Container is relative */
}

/* Auth Styling Only */
.auth-box {
    width: 100%;
    max-width: 400px;
    padding: 40px !important;
    border-radius: 24px !important;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    background: rgba(22, 24, 28, 0.95);
    /* More opaque */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* ABSOLUTE POSITIONING TO FIX STACKING */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* Ensure hidden works properly with absolute positioning */
.auth-box.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translate(-50%, -40%) !important;
    /* Slight slide up effect */
    z-index: -1;
    pointer-events: none;
}

/* Fix Chrome Autofill & Corners - v2 (Content Box Method) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    /* Use a huge transition delay to keep the browser from turning it white */
    transition: background-color 999999s ease-in-out 0s, color 999999s ease-in-out 0s;
    /* Force text color */
    -webkit-text-fill-color: white !important;
    /* Transparent shadow to override default white bg if transition fails */
    box-shadow: 0 0 0px 1000px #1d1f23 inset !important;
    border-radius: 12px !important;
    background-clip: padding-box !important;
}

.auth-box .logo {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 5px !important;
    text-align: center;
    background: linear-gradient(45deg, #fff, #bbb);
    -webkit-background-clip: text;
    background-clip: text;
    /* Standard Property */
    -webkit-text-fill-color: transparent;
}

.auth-box .tagline {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.1rem;
    display: block;
}

.auth-box .input-group {
    margin-bottom: 15px;
    width: 100%;
}

.auth-box input {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #1d1f23;
    /* Matching the autofill fallback color */
    color: white;
    font-size: 1rem;
    transition: 0.3s;
    outline: none;
}

.auth-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(244, 42, 53, 0.2);
}

.auth-box .btn-primary {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

.auth-box .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary-glow);
}

.auth-box .switch-text {
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-box .switch-text a {
    color: var(--primary);
    font-weight: 600;
}

.auth-box .btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 10px;
    font-size: 0.9rem;
    text-decoration: none;
}

.auth-box .hint-text {
    display: block;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 4px;
}