/**
 * Minimal Login Page Styles - Postavkin
 * Clean, centered design with floating labels
 */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--ff--base);
    font-weight: 400;
    line-height: 1.5;
    color: #1d1d1f;
    background: #f5f5f7;
    min-height: 100vh;
}

/* Alpine.js cloak */
[x-cloak] {
    display: none !important;
}

/* ==========================================================================
   Page Layout
   ========================================================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
}

/* ==========================================================================
   Card
   ========================================================================== */

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.08);
    text-align: center;
}

/* ==========================================================================
   Logo
   ========================================================================== */

.login-logo {
    display: inline-block;
    margin-bottom: 24px;
    transition: opacity 0.2s ease;
}

.login-logo:hover {
    opacity: 0.8;
}

.login-logo img {
    display: block;
    width: auto;
    height: 40px;
}

/* ==========================================================================
   Title
   ========================================================================== */

.login-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 32px;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   Subtitle (for forgot password page)
   ========================================================================== */

.login-subtitle {
    font-size: 0.9375rem;
    color: #6e6e73;
    line-height: 1.6;
    margin-top: -20px;
    margin-bottom: 28px;
}

/* ==========================================================================
   Icon (for forgot password page)
   ========================================================================== */

.login-icon {
    margin-bottom: 20px;
}

.login-icon svg {
    width: 56px;
    height: 56px;
    color: #fa0;
}

/* ==========================================================================
   Form
   ========================================================================== */

.login-form {
    text-align: left;
}

/* Floating Label Field */
.login-field {
    position: relative;
    margin-bottom: 24px;
}

.login-input {
    width: 100%;
    height: 56px;
    padding: 24px 16px 8px;
    font-family: inherit;
    font-size: 1rem;
    color: #1d1d1f;
    background: #ffffff;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.login-input--password {
    padding-right: 48px;
}

.login-input:hover {
    border-color: #86868b;
}

.login-input:focus {
    border-color: #fa0;
    box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.2);
}

/* Floating Label */
.login-label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #86868b;
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
}

/* Label moves up when input is focused or has value */
.login-input:focus + .login-label,
.login-input:not(:placeholder-shown) + .login-label {
    top: 12px;
    transform: translateY(0);
    font-size: 0.75rem;
    color: #6e6e73;
}

/* Password Toggle Button */
.login-toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #86868b;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.login-toggle-password:hover {
    color: #1d1d1f;
    background: rgba(0, 0, 0, 0.04);
}

.login-toggle-password svg {
    width: 20px;
    height: 20px;
}

/* Forgot Password Link */
.login-forgot {
    text-align: right;
    margin-bottom: 24px;
    margin-top: -16px;
}

.login-forgot a {
    font-size: 0.875rem;
    color: #fa0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-forgot a:hover {
    color: #e69900;
    text-decoration: underline;
}

/* ==========================================================================
   Button
   ========================================================================== */

.login-btn {
    position: relative;
    width: 100%;
    height: 52px;
    padding: 14px 28px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #fa0 0%, #f54562 100%);
    border: none;
    border-radius: 26px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245, 69, 98, 0.35);
}

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

.login-btn:disabled {
    cursor: not-allowed;
}

/* Loading State */
.login-btn--loading .login-btn__text {
    opacity: 0;
}

.login-btn__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    opacity: 0;
    animation: none;
}

.login-btn--loading .login-btn__spinner {
    opacity: 1;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.login-footer {
    margin-top: 32px;
    font-size: 0.9375rem;
    color: #6e6e73;
}

.login-footer a {
    color: #fa0;
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
    transition: color 0.2s ease;
}

.login-footer a:hover {
    color: #e69900;
    text-decoration: underline;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: left;
    animation: slideIn 0.3s ease-out;
}

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

.login-alert--error {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.login-alert--success {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.login-alert__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.login-alert__content {
    flex: 1;
}

.login-alert__content p {
    margin: 0;
}

.login-alert__content p + p {
    margin-top: 4px;
}

/* ==========================================================================
   Register Page Specific
   ========================================================================== */

.login-card--register {
    max-width: 420px;
}

.login-card--register .login-title {
    margin-bottom: 24px;
}

.login-card--register .login-field {
    margin-bottom: 20px;
}

/* Password Strength Indicator */
.login-strength {
    margin-top: -12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-strength__bar {
    display: flex;
    gap: 4px;
    flex: 1;
}

.login-strength__segment {
    height: 4px;
    flex: 1;
    background: #e5e5e5;
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.login-strength__segment.active.weak {
    background: #ff3b30;
}

.login-strength__segment.active.fair {
    background: #ff9500;
}

.login-strength__segment.active.good {
    background: #34c759;
}

.login-strength__segment.active.strong {
    background: #007aff;
}

.login-strength__label {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.login-strength__label.weak {
    color: #ff3b30;
}

.login-strength__label.fair {
    color: #ff9500;
}

.login-strength__label.good {
    color: #34c759;
}

.login-strength__label.strong {
    color: #007aff;
}

/* Checkbox */
.login-checkbox-wrapper {
    margin-bottom: 24px;
}

.login-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #6e6e73;
}

.login-checkbox__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.login-checkbox__box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 1px solid #d2d2d7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: #fff;
    margin-top: 1px;
}

.login-checkbox__box svg {
    width: 12px;
    height: 12px;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.login-checkbox__input:checked + .login-checkbox__box {
    background: #fa0;
    border-color: #fa0;
}

.login-checkbox__input:checked + .login-checkbox__box svg {
    opacity: 1;
    transform: scale(1);
}

.login-checkbox__input:focus + .login-checkbox__box {
    box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.2);
}

.login-checkbox__label {
    flex: 1;
}

.login-checkbox__label a {
    color: #fa0;
    text-decoration: none;
}

.login-checkbox__label a:hover {
    text-decoration: underline;
}

/* Captcha field */
.login-field--captcha {
    margin-bottom: 24px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet */
@media (max-width: 768px) {
    .login-card {
        padding: 40px 32px;
    }

    .login-title {
        font-size: 1.5rem;
        margin-bottom: 28px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .login-page {
        padding: 16px;
        align-items: stretch;
    }

    .login-card {
        min-height: calc(100vh - 32px);
        padding: 32px 24px;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Register page: don't force full height since it has more fields */
    .login-card--register {
        min-height: auto;
        justify-content: flex-start;
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .login-logo {
        margin-bottom: 20px;
    }

    .login-logo img {
        height: 36px;
    }

    .login-title {
        font-size: 1.375rem;
        margin-bottom: 24px;
    }

    .login-input {
        height: 52px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .login-field {
        margin-bottom: 20px;
    }

    .login-btn {
        height: 48px;
        font-size: 0.9375rem;
    }

    .login-footer {
        margin-top: 24px;
        font-size: 0.875rem;
    }

    .login-strength {
        margin-top: -8px;
        margin-bottom: 16px;
    }

    .login-checkbox {
        font-size: 0.8125rem;
    }
}

/* Extra small */
@media (max-width: 360px) {
    .login-page {
        padding: 12px;
    }

    .login-card {
        min-height: calc(100vh - 24px);
        padding: 24px 20px;
    }

    .login-card--register {
        min-height: auto;
        padding-top: 32px;
        padding-bottom: 32px;
    }

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

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
