/* --- New Global Modal/Form Styling --- */

/* Modal Overlay/Backdrop */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); 
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 2000; 
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Modal Content Wrapper */
.modal-content {
    position: relative;
    max-width: 450px;
    width: 90%;
    background: none; 
    padding: 0; 
    border-radius: 12px;
    box-shadow: none;
    transform: scale(0.95) translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden; 
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.5); 
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #1e293b;
    z-index: 2010;
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: background 0.2s, color 0.2s;
}

.modal-close-btn:hover {
    background: white;
    color: #3b82f6;
}

/* Premium Form Card Look (Frosted Glass Effect) */
.form-card {
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(20px); 
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 
                0 0 0 1px rgba(255, 255, 255, 0.3); 
    text-align: center;
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.form-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 32px;
}

.signup-form {
    text-align: left;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* --- FIX 1: Input Fields Refinement --- */
.form-group input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    color: #334155;
    border: 1px solid #cbd5e1;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); 
}

/* --- FIX 2: Password Eye Icon Positioning --- */
.password-group {
    position: relative;
}

.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #3b82f6;
}

/* --- FIX 3: Button Centering & Size --- */
.form-submit-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px 24px;
    font-size: 1.1rem; 
    font-weight: 700;
    /* FIX: This line centers the text horizontally inside the full-width button */
    justify-content: center; 
}

/* Divider Refinement */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 32px 0; 
    color: #94a3b8;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #d1d5db; 
}

.divider:not(:empty)::before {
    margin-right: 1em;
}

.divider:not(:empty)::after {
    margin-left: 1em;
}

/* Sign Up with Google Button Refinement */
.signup-google-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    margin-bottom: 24px;
    color: #1e293b;
    border: 1px solid #cbd5e1; 
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 
}

.signup-google-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8; 
}

.signup-google-btn .google-icon { /* Targeting the new img tag */
    margin-right: 8px;
    /* You can remove the old fill rule since the image handles its own color */
}

/* Login Prompt */
.login-prompt {
    font-size: 1rem;
    color: #64748b;
}

.link-primary {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 700; 
    transition: color 0.3s;
}

.link-primary:hover {
    color: #06b6d4;
    text-decoration: underline;
}

/* Alignment Fix: Ensure password input wrapper and standard input have the same visual flow */
.password-input-wrapper {
    position: relative;
    /* Make the wrapper act like a block-level input for consistent flow */
    display: block; 
}

/* Ensure the input inside the wrapper takes up full width for proper alignment */
.password-input-wrapper input {
    width: 100%; 
    /* Inherit the padding/styling of a standard input */
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    color: #334155;
    border: 1px solid #cbd5e1;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Positioning the Forgot Password link to the right, below the password field */
.forgot-password-link {
    display: block; 
    text-align: right;
    margin-top: 8px; /* Adds space between input field and the link */
    font-size: 0.9rem; /* Match the label size */
}

/* Adjust the password toggle positioning */
.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

/* Update the general form group styling to set consistent vertical spacing */
.signup-form .form-group,
.login-form .form-group {
    text-align: left;
    /* Use a margin-bottom of 20px for clear separation between fields */
    margin-bottom: 20px; 
}

/* Ensure the last form-group doesn't have extra margin at the bottom */
.signup-form .form-group:last-of-type,
.login-form .form-group:last-of-type {
    margin-bottom: 0;
}

/* ----------------------------------- */
/* PROFILE UI STYLES (NEW/UPDATED) */
/* ----------------------------------- */

/* Style the Avatar Letter Circle */
#profileLetter {
    /* Styling the avatar circle */
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 10vw; 
    height: 36px;
    border-radius: 5px;
    background: linear-gradient(50deg, #3b82f6, #06b6d4); /* A slightly softer primary blue/purple */
    color: white;
    font-weight: 600; /* Semi-bold */
    font-size: 16px;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 0 0 2px rgba(93, 93, 255, 0.2); /* Subtle glow */
}

/* Ensure the icon button wraps the letter properly */
.profile-container .btn-icon {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* Dropdown Menu Container */
.dropdown-menu {
    display: none; /* Initially hide the dropdown */
    position: absolute;
    top: calc(100% + 10px); /* Position it 10px below the profile icon */
    right: 0;
    min-width: 240px;
    padding: 10px 0;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); /* Stronger, professional shadow */
    z-index: 1000;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.dropdown-menu.active {
    display: block; /* Show when the 'active' class is applied by utils.js */
    opacity: 1;
    transform: translateY(0);
}

/* Header for "Logged in as:" */
.dropdown-header {
    font-size: 12px;
    color: #757575;
    padding: 5px 15px 2px 15px;
    margin: 0;
}

/* User Email Display */
.dropdown-email {
    font-size: 18px;
    font-weight: 500;
    color: #333333;
    padding: 0 15px 10px 15px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Individual Menu Item Link */
.dropdown-item {
    display: flex; /* <-- CHANGE THIS */
    align-items: center; /* Vertically align icon and text */
    gap: 10px; /* Space between icon and text (adjust as needed) */
    padding: 10px 15px;
    text-decoration: none;
    color: #333333;
    font-size: 18px;
    transition: background-color 0.15s;
}

.dropdown-item img {
    width: 20px;
    height: 20px;
    /* margin-right: 5px; - This is now handled by the gap property */
    vertical-align: middle; 
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

/* Divider line */
.dropdown-divider {
    margin: 10px 0;
    border: none;
    border-top: 1px solid #eeeeee;
}

/* Logout Button */
.btn-logout {
    width: 90%;
    margin: 0 5%; /* Center the button */
    padding: 8px 15px;
    background-color: #ee645a; /* Red for logout */
    color: white;
    border: none;
    border-radius: 4px;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.15s;
}

.btn-logout:hover {
    background-color: #c92a28;
}

.mobile-profile-content {
    display: none;
}

#mobileProfileContent {
    display: none;
}

/* Placeholder CSS to make the dropdown functional */
.profile-container {
    position: relative; /* Essential for positioning the dropdown menu */
}

/* loader styling */
/* --- LOADER CSS (Add your provided code here) --- */
:root{
    --color-dark-bg: #12121e;
    --color-accent: #00e0ff;
    --loader-size: 60px; /* Note: We will override this for the button */
    --loader-border: 8px; /* Note: We will override this for the button */
    --shadow-alpha: 0.45;
  }
  
  /* LOADER BASE STYLES */
  .loader {
    /* Set size appropriate for a button */
    width: 24px; 
    aspect-ratio: 1;
    border-radius: 50%;
    border: 3px solid var(--color-accent); /* Adjusted border size */
    animation:
      l20-1 0.8s infinite linear alternate,
      l20-2 1.6s infinite linear;
    box-shadow: 0 0 6px rgba(0,224,255,var(--shadow-alpha)); /* Adjusted shadow */
    background-clip: padding-box;
    position: relative;
    
    /* Hide by default until activated */
    display: none; 
  }
  
  /* inner glow ring */
  .loader::before{
    content: "";
    position: absolute;
    /* Adjust inset to match the new 3px border */
    inset: 3px; 
    border-radius: 50%;
    box-shadow: inset 0 0 5px rgba(0,224,255,0.12);
    background: var(--color-dark-bg);
    z-index: 0;
  }
  
  /* The button container for the loader */
  .form-submit-btn.loading {
    /* Disable pointer events when loading */
    pointer-events: none; 
    /* Center the loader */
    display: flex; 
    justify-content: center;
    align-items: center;
  }
  
  .form-submit-btn.loading .btn-text-content {
    /* Hide the text content when loading */
    display: none; 
  }
  
  .form-submit-btn.loading .loader {
    /* Show the loader when loading */
    display: block; 
  }
  
  /* clip animation */
  @keyframes l20-1 { /* ... your clip-path keyframes ... */ }
  
  /* flip + rotation */
  @keyframes l20-2 { /* ... your flip + rotation keyframes ... */ }
  

/* Add this block to your modal.css or primary stylesheet */
@media (min-width: 768px) {
    /* This overrides the JavaScript's mobile-specific 'display: flex' on desktop */
    #mobileProfileContent {
        display: none !important;
    }
    
    /* Ensure the mobile authentication buttons are also hidden, just in case */
    .nav-actions-mobile {
        display: none !important;
    }
}
  
/* Responsive Adjustments */
@media (max-width: 480px) {
    .modal-content {
        max-width: 100%;
        margin: 0 10px; 
    }

    .form-card {
        padding: 30px 20px; 
    }

    .form-title {
        font-size: 1.5rem;
    }

    .form-subtitle {
        font-size: 0.9rem;
    }

    .mobile-profile-content {
        display: flex;
        flex-direction: column;
    }
}
