/* =========================================
   Authentication Modals
   ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    /* Darker backdrop */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    /* Above everything */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: rgba(30, 30, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: none;
    /* Hidden by default */
}

/* Specific display state when parent overlay is enabled and this card is target */
.modal-overlay.active .modal-card:not(.hidden) {
    display: block;
    transform: scale(1);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: #fff;
    margin: 0;
}

.modal-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    /* Ensure full width */
    box-sizing: border-box;
}

.input-icon {
    position: absolute;
    /* Removed shared positioning to allow individual control */
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 10;
}

/* Individual Icon Alignment - Using Legacy Positioning (top: 0.75rem) */
.icon-user {
    left: 1rem;
    width: 20px;
    height: 20px;
}

.icon-mail {
    left: 1rem;
    width: 20px;
    height: 20px;
    top: 1.5rem;
}

.icon-lock {
    left: 1rem;
    width: 20px;
    height: 20px;
    top: 1.5rem;
}

/* HIGH SPECIFICITY INPUT STYLES */
/* Use .modal-card prefix to override global style.css */
.modal-card .auth-form input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem 0.75rem 3rem !important;
    /* Force left padding for icon */
    color: #fff;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
    margin: 0;
    /* Reset margins */
    height: auto;
    min-height: auto;
    /* Override global style.css input[type="text"] min-height */
    line-height: normal;
}

/* Force right padding for password-like fields (covers toggle state) */
.modal-card .auth-form input[type="password"],
.modal-card .auth-form input[id*="password"] {
    padding-right: 3rem !important;
}

.auth-form input:focus {
    border-color: var(--accent-orange);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.1);
}

.input-wrapper:focus-within .input-icon {
    color: var(--accent-orange);
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    /* Legacy value */
    top: 0.75rem;
    /* Legacy value */
    transform: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.forgot-password {
    color: var(--accent-orange);
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
}

.forgot-password:hover {
    text-decoration: underline;
}

.btn-primary-block {
    background: var(--accent-orange);
    color: var(--bg-color);
    /* Dark text */
    border: none;
    padding: 0.875rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

.btn-primary-block:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider span {
    padding: 0 1rem;
}

/* Brand Text */
.brand-text-lg {
    font-size: 2.25rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: #fff;
    /* Basic white for now, can be gradient */
    margin: 0;
    letter-spacing: -0.02em;
    font-style: italic;
    /* Match italic feel of Bolt if desired, or just PROMPT-PLUS brand */
}

/* Auth Options Stack */
.auth-options-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Universal Auth Button */
.btn-auth-option {
    width: 100%;
    padding: 0.875rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border: 1px solid transparent;
    position: relative;
    font-family: var(--font-base);
}

.btn-auth-option:hover {
    transform: translateY(-1px);
}

/* GitHub Button */
.btn-github {
    background: #242424;
    /* Dark grey */
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-github:hover {
    background: #2f2f2f;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Email Button - mimicking the 'secondary' look or primary depending on pref */
.btn-email {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-email:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Google Button override for stack */
.btn-google {
    /* Retain existing background #fff */
    color: #333;
    border: none;
}

.btn-google:hover {
    background: #f1f1f1;
}

/* Badge for 'Last Used' - Optional */
.badge-last-used {
    position: absolute;
    right: -0.5rem;
    top: -0.5rem;
    background: #333;
    color: #aaa;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    border: 1px solid #444;
}

/* Modal Footer Update */
.modal-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Link Button in Footer */
.link-btn {
    text-decoration: underline;
    opacity: 0.8;
}

.link-btn:hover {
    opacity: 1;
}

/* Checkbox Styling */
.checkbox-group {
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex !important;
    /* Override potential display:none */
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.checkbox-custom {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 2px;
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--accent-orange);
    background: rgba(251, 146, 60, 0.05);
}

.checkbox-label input:checked~.checkbox-custom {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.checkbox-custom::after {
    content: "";
    position: absolute;
    opacity: 0;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.checkbox-label input:checked~.checkbox-custom::after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

.label-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.label-text a {
    color: var(--accent-orange);
    text-decoration: none;
}

.label-text a:hover {
    text-decoration: underline;
}

/* Error Text Styling (General for both modal and signup page) */
.error-text {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
    font-weight: 500;
}

.input-invalid {
    border-color: #ef4444 !important;
}

/* Success Modal Styling */
.notification-modal {
    text-align: center;
    z-index: 1100;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: #000 !important;
    /* Solid black */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: none !important;
    /* Remove glass on card itself */
    -webkit-backdrop-filter: none !important;
    padding: 2rem;
    /* Add padding for breathing room */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center items flex-wise */
}

/* Ensure text is centered */
.notification-modal h2,
.notification-modal p {
    text-align: center;
    width: 100%;
}

/* Success Modal Button Specifics */
#success-ok-btn {
    width: 100%;
    margin-top: 1rem;
    background: var(--accent-orange);
    color: var(--bg-color);
    border: none;
    padding: 0.875rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s ease;
}

#success-ok-btn:hover {
    transform: none;
    /* Remove slide effect */
    filter: brightness(1.2);
    /* Brighten color */
}

/* Specific overlay for success modal to have extra blur */
#success-overlay {
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    background: rgba(0, 0, 0, 0.4);
    /* Slightly darker */
}

/* Ensure the main overlay also has enough blur when success shows there */
.modal-overlay.active {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.notification-modal.hidden {
    display: none !important;
}

.success-icon-wrapper {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    animation: successPulse 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#success-title {
    color: #fff;
    margin-bottom: 0.75rem;
}

#success-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Ensure visibility on standalone pages like signup.html */
.notification-modal:not(.hidden) {
    display: block !important;
}

.hidden {
    display: none !important;
}