/**
 * Login Page Styles
 * Extracted from login.blade.php for maintainability.
 * Uses CSS custom properties from theme-variables + login-specific vars.
 *
 * Login-specific variables (injected inline by Blade):
 *   --login-bg-start, --login-bg-end
 */

:root {
    --color-primary-light: color-mix(in srgb, var(--color-primary) 80%, #fff);
}

/* ============================================================
   LAYOUT
   ============================================================ */

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--login-bg-start) 0%, var(--login-bg-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.login-container {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(29, 58, 87, 0.15);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 450px;
    position: relative;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.6s ease-out;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--color-primary-light) 0%, var(--color-primary-dark) 100%);
    border-radius: 20px 20px 0 0;
}

/* ============================================================
   LOGO SECTION
   ============================================================ */

.logo-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-image {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    filter: drop-shadow(0 8px 25px rgba(var(--color-primary-rgb), 0.2));
}

.logo-title {
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

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

.form-floating {
    margin-bottom: 1.5rem;
}

.form-control {
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 0.75rem;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all 0.3s ease;
    height: calc(3.5rem + 2px);
}

.form-control:focus {
    background: var(--bg-card);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--color-primary-rgb), 0.15);
    outline: none;
}

.form-floating > label {
    color: var(--text-muted);
    font-weight: 500;
    padding: 1rem 0.75rem;
}

/* ============================================================
   LOGIN BUTTON
   ============================================================ */

.btn-login {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: 12px;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--color-primary-rgb), 0.4);
    color: white;
}

.btn-login:active {
    transform: translateY(0);
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(12, 175, 96, 0.1);
    color: var(--color-success);
    border-left: 4px solid var(--color-success);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-left: 4px solid #dc3545;
}

/* ============================================================
   HELP TEXT (FOOTER)
   ============================================================ */

.help-text {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.help-text small {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.help-text i {
    color: var(--color-primary);
    margin-left: 0.5rem;
}

/* ============================================================
   LOGIN TYPE SELECTOR
   ============================================================ */

.login-type-selector {
    margin-bottom: 2rem;
}

.btn-group .btn-outline-primary,
.btn-group .btn-outline-success {
    border: 2px solid;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.btn-group .btn-outline-primary {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-group .btn-outline-success {
    border-color: var(--color-success);
    color: var(--color-success);
}

.btn-check:checked + .btn-outline-primary {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3);
}

.btn-check:checked + .btn-outline-success {
    background: var(--color-success);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(12, 175, 96, 0.3);
}

.login-form {
    animation: fadeInUp 0.4s ease-out;
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid;
    border-color: white transparent white transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ============================================================
   PWA INSTALL BUTTON
   ============================================================ */

.pwa-install-container {
    margin: 1.5rem 0;
}

.btn-install-app {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-dark) 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: white;
    font-family: var(--font-family);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.2);
    cursor: pointer;
}

.btn-install-app::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-install-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--color-primary-rgb), 0.3);
    border-color: rgba(255,255,255,0.2);
}

.btn-install-app:hover::before {
    left: 100%;
}

.btn-install-app:active {
    transform: translateY(0);
}

.install-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* ============================================================
   iOS INSTALL MODAL
   ============================================================ */

.ios-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.ios-modal-content {
    background: var(--bg-card);
    max-width: 400px;
    margin: 10vh auto;
    padding: 2rem;
    border-radius: 16px;
    position: relative;
    text-align: center;
    direction: rtl;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.ios-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ios-close:hover {
    background: var(--border-color);
    color: var(--text-secondary);
}

.ios-header {
    margin-bottom: 1.5rem;
    color: var(--color-primary-dark);
}

.ios-instructions p {
    text-align: right;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(30, 168, 165, 0.05);
    border-radius: 8px;
    border-right: 3px solid var(--color-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.ios-instructions i {
    color: var(--color-primary);
    margin-left: 0.5rem;
}

/* ============================================================
   PWA SPLASH SCREEN
   ============================================================ */

.pwa-splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--login-bg-start, var(--color-primary)) 0%, var(--login-bg-end, var(--color-primary-dark)) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.pwa-splash-screen.active {
    opacity: 1;
    visibility: visible;
}

.splash-logo {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(255, 255, 255, 0.3));
    animation: splashPulse 2s ease-in-out infinite;
}

.splash-text {
    color: white;
    font-family: var(--font-family);
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2rem;
    text-align: center;
    opacity: 0.9;
}

.splash-loading {
    margin-top: 2rem;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: splashSpin 1s linear infinite;
}

@media (display-mode: standalone) {
    .pwa-splash-screen {
        display: flex !important;
    }
}

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes splashSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .login-container {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .logo {
        max-width: 120px;
        max-height: 120px;
    }

    .logo-title {
        font-size: 1.25rem;
    }

    .btn-install-app {
        font-size: 0.85rem;
        padding: 0.65rem 1.25rem;
    }

    .ios-modal-content {
        margin: 5vh 1rem;
        padding: 1.5rem;
    }
}
