/**
 * COEUS Design System - Login Page Components
 *
 * PURPOSE:
 * Styles for the login/authentication page including passkey registration
 *
 * COMPONENTS:
 * - .login-container - Full-height container for login card
 * - .login-card - Glassmorphism card with form
 * - .login-logo - Logo container (displays COEUS.png without background)
 * - .passkey-button - Primary action button for passkey auth
 * - .form-input - Input field styling
 * - .notification - Toast notification system
 * - .notification-icon-* - Theme-aware notification icon colors
 * - .code-input - 6-digit verification code inputs
 * - .divider - "oder" separator with horizontal lines
 *
 * DEPENDENCIES: core/variables.css, core/themes.css
 * LAST UPDATED: 2025-11-23 - Theme-Aware Color Fix:
 *               - Replaced var(--ios-label) with var(--text-primary) for theme responsiveness
 *               - Added .notification-icon-success/error/info classes using iOS system colors
 *               - All text now uses theme-aware variables (works in light & dark mode)
 *               - Fixed .login-title and .code-input to use var(--text-primary)
 *               - Removed all hardcoded color references
 *               V2 Styling Fix (2025-11-23):
 *               - Removed orange gradient background from .login-logo
 *               - Fixed logo to display COEUS.png properly with object-fit: contain
 *               - Fixed .divider spacing to 2rem (32px) top/bottom
 *               - Removed duplicate .divider definition (CSS cascade conflict)
 *               - All styling uses CSS classes only (no inline styles)
 */

/* ============================================ */
/*              LOGIN CONTAINER                 */
/* ============================================ */

/**
 * .login-container
 * Full-screen container with centered login card
 * Uses fixed positioning to viewport to prevent layout shifts
 */
.login-container {
    position: fixed !important; /* Fixed to viewport - not affected by body height */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: 40px;
    z-index: 1; /* Above video background but below modals */
}

/* ============================================ */
/*              LOGIN CARD                      */
/* ============================================ */

/**
 * .login-card
 * Main card with glassmorphism effect (theme-aware)
 * Animated slide-up entrance
 */
.login-card {
    background: var(--glass-primary); /* Theme-aware glass background */
    backdrop-filter: var(--blur-strong);
    -webkit-backdrop-filter: var(--blur-strong);
    border: 1px solid var(--glass-border); /* Theme-aware border */
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: slideUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0;
    margin-top: 0; /* Removed 20vh margin - container centers it */
}

@media (min-width: 480px) {
    .login-card {
        padding: 40px 32px;
    }
}

/* ============================================ */
/*              LOGIN HEADER                    */
/* ============================================ */

/**
 * .login-header
 * Header section with logo and title
 */
.login-header {
    text-align: center;
    margin-bottom: 40px;
}

/**
 * .login-logo
 * Logo container - displays COEUS.png without background
 */
.login-logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    position: relative;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/**
 * .login-title
 * Main title text using iOS title size
 */
.login-title {
    font-size: var(--ios-title1);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

/**
 * .login-subtitle
 * Subtitle text below title
 */
.login-subtitle {
    font-size: var(--ios-subheadline);
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================ */
/*              FORM ELEMENTS                   */
/* ============================================ */

/**
 * .form-group
 * Container for form fields with spacing
 */
.form-group {
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.form-group h2,
.form-group p {
    text-align: center;
}

/**
 * .form-label
 * Label for form inputs
 */
.form-label {
    display: block;
    font-size: var(--ios-footnote);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/**
 * .form-input
 * Standard text input with glassmorphism
 */
.form-input {
    width: 100%;
    padding: 16px 20px;
    background: var(--ios-glass-thin);
    border: 1px solid var(--ios-separator);
    border-radius: 12px;
    font-size: var(--ios-callout);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-sizing: border-box;
    text-align: center;
}

.form-input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* ============================================ */
/*              BUTTONS                         */
/* ============================================ */

/**
 * .glass-button
 * Secondary button with glassmorphism
 * Note: Primary variant defined in themes.css
 */

/**
 * .glass-button-primary
 * Primary action button with orange gradient
 */
.glass-button-primary {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    color: white !important;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    user-select: none;
    text-decoration: none;
    font-family: var(--font-ui, 'Figtree', sans-serif);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
    transition: all 0.2s ease;
}

.glass-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.glass-button-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.glass-button-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    mix-blend-mode: overlay;
    pointer-events: none;
}

.glass-button-primary * {
    color: white !important;
    position: relative;
    z-index: 1;
}

/**
 * .passkey-button
 * Large button for passkey authentication
 * Features gradient background and icon support
 */
.passkey-button {
    background:
        linear-gradient(135deg, #f97316 0%, #fb923c 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");
    background-blend-mode: overlay;
    color: white !important;
    border: none;
    border-radius: var(--radius-md);
    padding: 20px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: var(--ios-callout);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.passkey-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    mix-blend-mode: overlay;
    pointer-events: none;
}

.passkey-button * {
    color: white !important;
    position: relative;
    z-index: 1;
}

.passkey-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.4);
}

/**
 * .passkey-button-green
 * Green variant for registration success
 */
.passkey-button-green {
    background:
        linear-gradient(135deg, var(--ios-system-green), #28a745),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");
    background-blend-mode: overlay;
    margin-bottom: var(--spacing-lg);
}

/* ============================================ */
/*              PASSKEY BUTTON CONTENT          */
/* ============================================ */

.passkey-icon {
    font-size: 24px;
}

.passkey-text {
    text-align: center;
}

.passkey-title {
    font-weight: 700;
}

.passkey-subtitle {
    font-size: var(--ios-caption1);
    opacity: 0.9;
}

.fingerprint-icon {
    font-size: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================ */
/*              DIVIDER                         */
/* ============================================ */

/**
 * .divider
 * Separator with "oder" (or) text
 * REMOVED - Duplicate definition exists at line 532
 */

/* ============================================ */
/*              CODE INPUTS                     */
/* ============================================ */

/**
 * .code-input
 * Individual input for 6-digit verification code
 * Uses !important for width to override any inherited styles
 */
input.code-input {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 60px;
    flex: 0 0 50px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    background: var(--glass-secondary);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

input.code-input:focus {
    border-color: #f97316;
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
    background: var(--glass-hover);
}

.code-input-centered {
    text-align: center;
    font-family: monospace;
}

/* ============================================ */
/*              VERIFICATION BOX                */
/* ============================================ */

/**
 * .verification-box
 * Container for 8-digit verification code input
 */
.verification-box {
    background: var(--ios-glass-thin);
    border: 1px solid var(--ios-separator);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
}

.verification-box-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.verification-icon {
    color: var(--ios-system-orange);
    margin-top: 4px;
    font-size: 1.2rem;
}

.verification-box-text {
    flex: 1;
}

.verification-label {
    display: block;
    font-size: var(--ios-footnote);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.verification-hint {
    font-size: var(--ios-caption1);
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.error-message {
    margin-top: 8px;
    font-size: var(--ios-footnote);
    color: var(--ios-system-red);
}

/* ============================================ */
/*              NOTIFICATIONS                   */
/* ============================================ */

/**
 * .notification
 * Toast notification system
 * Shows in top-right corner
 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-modal);
    opacity: 0;
    transform: translateY(-20px);
    transition: all var(--transition-base);
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-content {
    background: var(--ios-glass-regular);
    backdrop-filter: var(--blur-strong);
    -webkit-backdrop-filter: var(--blur-strong);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
}

/**
 * Notification icon colors (theme-aware using iOS system colors)
 */
.notification-icon-success {
    color: var(--ios-system-green) !important;
}

.notification-icon-error {
    color: var(--ios-system-red) !important;
}

.notification-icon-info {
    color: var(--ios-system-blue) !important;
}

/* ============================================ */
/*              ANIMATIONS                      */
/* ============================================ */

/**
 * @keyframes slideUp
 * Entrance animation for login card
 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/**
 * .step-content
 * Fade-in animation for step transitions
 * Override rental-protocol.css defaults for login page
 */
.step-content {
    display: none !important; /* Hidden by default */
}

.step-content.active {
    display: block !important; /* Force visible when active */
    animation: fadeIn 0.3s ease forwards; /* Animate in and stay visible */
    opacity: 1; /* Ensure visibility after animation */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================ */
/*              UTILITY CLASSES                 */
/* ============================================ */

.btn-full-width {
    width: 100%;
}

.btn-mb-16 {
    margin-bottom: 16px;
}


/* Divider & Passkey Button Styles (Theme-aware) */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-transform: lowercase;
    padding: 0 0.5rem;
    background: transparent;
}

.passkey-button {
    width: 100%;
    padding: 1rem;
    background: var(--glass-primary);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.passkey-button:hover {
    background: var(--glass-hover);
    transform: translateY(-1px);
}

.passkey-button:active {
    transform: translateY(0);
}

.fingerprint-icon {
    font-size: 1.5rem;
    color: var(--ios-system-blue);
}
