/* Phila Auth Modal Styles - PROPOSED NEW DESIGN */

/* Reset & Fonts being inherited usually, but specifying for safety */
.phila-modal,
.phila-modal * {
    box-sizing: border-box;
}

.phila-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    /* Slightly darker backdrop */
    backdrop-filter: blur(2px);
    /* Modern blur effect */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.phila-modal-content {
    background-color: #ffffff;
    margin: 8% auto;
    padding: 40px;
    border: none;
    width: 90%;
    max-width: 440px;
    /* Wider for breathability */
    position: relative;
    border-radius: 16px;
    /* Softer rounded corners */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* Deep drop shadow */
}

.phila-close {
    color: #9ca3af;
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.phila-close:hover,
.phila-close:focus {
    color: #1f2937;
    text-decoration: none;
}

.phila-auth-form h2 {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
    color: #111827;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.phila-form-group {
    margin-bottom: 20px;
}

.phila-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    /* Bolder */
    color: #111827;
    /* Darker */
    font-size: 14px;
}

.phila-form-helper {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    /* Gray 500 */
    font-size: 13px;
    line-height: 1.4;
}

.phila-form-group input[type="text"],
.phila-form-group input[type="email"],
.phila-form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    color: #1f2937;
    transition: all 0.2s ease;
    background-color: #f9fafb;
}

.phila-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    color: #1f2937;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    min-height: 120px;
    /* Taller by default */
    resize: vertical;
}

/* Fix for Chrome yellow autofill */
.phila-form-group input:-webkit-autofill,
.phila-form-group input:-webkit-autofill:hover,
.phila-form-group input:-webkit-autofill:focus,
.phila-form-group input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #f9fafb inset !important;
    -webkit-text-fill-color: #1f2937 !important;
}

.phila-form-group input:focus,
.phila-form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    /* Increased opacity for visibility */
}

/* Validation Styles */
.phila-form-group input.phila-input-error,
.phila-form-group textarea.phila-input-error {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.phila-form-group input.phila-input-error:focus,
.phila-form-group textarea.phila-input-error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.phila-field-error-text {
    color: #dc2626;
    /* WCAG AA Compliant Red */
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
    min-height: 20px;
    /* Prevent layout jump */
    display: none;
    /* Hidden by default */
}

.phila-field-error-text:not(:empty) {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Password Toggle */
.phila-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.phila-password-wrapper input {
    padding-right: 40px;
    /* Space for icon */
}

.phila-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

.phila-password-toggle:hover {
    color: #4b5563;
}

.phila-remember-me {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.phila-remember-me label {
    margin-bottom: 0;
    font-weight: 400;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.phila-remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}

.phila-submit-btn {
    width: 100%;
    padding: 12px;
    background-color: #2563eb;
    /* Vivid Blue */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

.phila-submit-btn:hover {
    background-color: #1d4ed8;
}

.phila-switch-link {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #6b7280;
}

.phila-switch-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

/* Divider */
.phila-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 500;
}

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

.phila-divider span {
    padding: 0 10px;
}

.phila-char-count-wrapper {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Google Button */
.phila-google-btn {
    width: 100%;
    padding: 12px;
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0;
    /* Handled by divider */
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.phila-google-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

/* Messages */
.phila-error-message,
.phila-success-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

.phila-error-message {
    background-color: #fef2f2;
    color: #991b1b;
    /* Dark red for text */
    border: 1px solid #fee2e2;
}

/* Message Accessiblity Update */
.phila-success-message {
    background-color: #dcfce7;
    color: #15803d;
    /* Darker green (WCAG AA) */
    border: 1px solid #bbf7d0;
}

/* Leaked Password Check */
.phila-checking {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 5px;
}

.phila-checking::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #e5e7eb;
    border-top-color: #6b7280;
    border-radius: 50%;
    animation: phila-spin 1s linear infinite;
}

@keyframes phila-spin {
    to {
        transform: rotate(360deg);
    }
}

.phila-leaked-warning {
    font-size: 13px;
    font-weight: 500;
}

.phila-leaked-safe {
    font-size: 13px;
    font-weight: 500;
}

/* Tooltip Styles */
.phila-tooltip-trigger {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 5px;
    position: relative;
    font-weight: 500;
    font-size: 12px;
}

.phila-tooltip-content {
    visibility: hidden;
    width: 240px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    /* Position above trigger */
    left: 50%;
    margin-left: -120px;
    /* Center */
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.phila-tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.phila-tooltip-trigger:hover .phila-tooltip-content,
.phila-tooltip-trigger:focus .phila-tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Password Hint Box */
.phila-password-hint {
    margin-top: 10px;
    font-size: 13px;
    color: #374151;
    background-color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    line-height: 1.5;
}

.phila-password-hint strong {
    color: #111827;
}

/* Reset Page Container */
.phila-reset-password-container {
    max-width: 480px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.phila-reset-password-container h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 24px;
    color: #111827;
}

/* Profile Avatar Styles */
.phila-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center everything */
    margin-bottom: 24px;
}

.phila-avatar-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    /* Circle */
    overflow: hidden;
    margin-bottom: 12px;
    border: 3px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background-color: #f3f4f6;
    /* Placeholder bg */
}

/* Target the img inside specifically if needed, but the class should handle it */
img.phila-avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Remove bottom space */
}

.phila-avatar-btn {
    cursor: pointer;
    color: #2563eb;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.phila-avatar-btn:hover {
    background-color: #eff6ff;
    color: #1d4ed8;
}

/* Hide the actual file input */
#phila-avatar-upload {
    display: none;
}

/* Header User Menu Styling */
.phila-user-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.phila-user-link img {
    border-radius: 50%;
    width: 32px;
    /* Enforce size */
    height: 32px;
    object-fit: cover;
    margin-right: 0 !important;
    /* Reset potential theme margins */
}