/* ============================================================
   Bakandamiya POS — Login & Auth Pages
   ============================================================
   Imports the shared design system, then defines login-specific
   layout styles. No hardcoded colors or magic numbers.
   ============================================================ */

/* ── Shared Design System ──────────────────────────────────── */
@import url('variables.css');
@import url('reset.css');

/* ── Login-Specific Overrides ──────────────────────────────── */
/* The login page uses a unique lavender background, not the
   standard --bg-page gray used by authenticated app pages. */
:root {
    --login-bg: var(--bg-page);
}

body {
    background: var(--login-bg);
    display: flex;
    flex-direction: column;
}

a:hover {
    text-decoration: underline;
}


/* ═══════════════════════════════════════════════════════════
   LOGIN CONTAINER (Split Layout)
   ═══════════════════════════════════════════════════════════ */

.login-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 52px);
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    gap: var(--space-16);
}


/* ═══════════════════════════════════════════════════════════
   BRANDING PANEL (Left Side)
   ═══════════════════════════════════════════════════════════ */

.branding-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
}

.brand-icon-wrapper {
    width: 72px;
    height: 72px;
    margin-bottom: var(--space-6);
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.brand-icon-wrapper svg {
    width: 100%;
    height: 100%;
}

.branding-panel h1 {
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    letter-spacing: -0.5px;
    margin-bottom: var(--space-2);
}

.branding-panel .version-tag {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-muted);
    letter-spacing: 4px;
    text-transform: uppercase;
}


/* ═══════════════════════════════════════════════════════════
   LOGIN CARD (Right Side)
   ═══════════════════════════════════════════════════════════ */

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease-out;
}

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

.login-header {
    margin-bottom: var(--space-8);
}

.login-header .brand-label {
    display: block;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-primary);
    margin-bottom: var(--space-1);
}

.login-header h2 {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: var(--space-1);
}

.login-header p {
    font-size: var(--text-base);
    color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════════════════════════════════ */

.flash-message {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    animation: fadeIn var(--duration-slow) ease;
}

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

.flash-message.error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}

.flash-message.success {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}


/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    margin-bottom: var(--space-2);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-icon {
    position: absolute;
    left: var(--space-3);
    width: 20px;
    height: 20px;
    color: var(--text-light);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-colors);
}

.input-wrapper .input-icon svg {
    width: 20px;
    height: 20px;
}

.input-wrapper input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-3) + 20px + var(--space-2));
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-heading);
    background: var(--bg-card);
    outline: none;
    transition: var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.input-wrapper input::placeholder {
    color: var(--text-light);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 var(--ring-width) var(--ring-color);
}

.input-wrapper input:focus ~ .input-icon {
    color: var(--color-primary);
}

.toggle-password {
    position: absolute;
    right: var(--space-3);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-colors);
}

.toggle-password:hover {
    color: var(--text-muted);
}

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


/* ═══════════════════════════════════════════════════════════
   REMEMBER ME & FORGOT PASSWORD
   ═══════════════════════════════════════════════════════════ */

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
    border-radius: var(--radius-xs);
}

.checkbox-wrapper label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.forgot-link {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-primary);
}

.forgot-link:hover {
    color: var(--color-primary-dark);
}


/* ═══════════════════════════════════════════════════════════
   SUBMIT BUTTON
   ═══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-arrow {
    transition: transform var(--duration-normal) ease;
}

.btn-primary:hover .btn-arrow {
    transform: translateX(3px);
}

/* Loading Spinner */
.btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text,
.btn.loading .btn-arrow { display: none; }

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


/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

.login-footer {
    background: var(--color-surface-1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: var(--space-3) var(--space-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.footer-links {
    display: flex;
    gap: var(--space-6);
}

.footer-links a {
    color: var(--text-body);
    font-weight: var(--weight-medium);
}

.footer-links a:hover {
    color: var(--color-primary);
}


/* ═══════════════════════════════════════════════════════════
   FORGOT PASSWORD MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-slow) ease, visibility var(--duration-slow) ease;
    padding: var(--space-4);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--duration-slow) ease;
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.modal-header h3 {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-colors);
}

.modal-close:hover {
    background: var(--color-gray-100);
    color: var(--text-heading);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body p {
    font-size: var(--text-base);
    color: var(--text-muted);
    margin-bottom: var(--space-5);
    line-height: var(--leading-normal);
}

.modal-body .form-group {
    margin-bottom: var(--space-5);
}

/* Modal-specific message */
.modal-message {
    display: none;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-4);
    line-height: var(--leading-normal);
}

.modal-message.visible {
    display: block;
    animation: fadeIn var(--duration-slow) ease;
}

.modal-message.error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}

.modal-message.success {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

/* Dev-only reset link display */
.dev-reset-link {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius-md);
    word-break: break-all;
    font-size: var(--text-xs);
    color: var(--color-warning);
}

.dev-reset-link strong {
    display: block;
    margin-bottom: var(--space-1);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dev-reset-link a {
    color: var(--color-warning);
    text-decoration: underline;
}


/* ═══════════════════════════════════════════════════════════
   RESET PASSWORD PAGE
   ═══════════════════════════════════════════════════════════ */

.auth-page-centered {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    min-height: calc(100vh - 52px);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease-out;
}

.auth-card .brand-label {
    display: block;
    text-align: center;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-primary);
    margin-bottom: var(--space-3);
}

.auth-card h2 {
    text-align: center;
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: var(--space-1);
}

.auth-card .subtitle {
    text-align: center;
    font-size: var(--text-base);
    color: var(--text-muted);
    margin-bottom: var(--space-8);
}

.auth-card .back-link {
    display: block;
    text-align: center;
    margin-top: var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.auth-card .back-link a {
    font-weight: var(--weight-semibold);
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        gap: var(--space-8);
        padding: var(--space-8) var(--space-6);
    }

    .branding-panel {
        display: none;
    }

    .login-card {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .login-card,
    .auth-card {
        padding: var(--space-6);
    }

    .login-footer {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
        padding: var(--space-4);
    }

    .footer-links {
        gap: var(--space-4);
    }

    .modal-card {
        padding: var(--space-6);
    }
}
