/* ============================================
   FLEX ACCESS BANK - RESPONSIVE LOGIN STYLES
   Mobile-first design with desktop enhancements
   ============================================ */

/* CSS Custom Properties for easy theming */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --black: #000000;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --transition: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-100);
    min-height: 100vh;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* ============================================
   LOGIN PAGE - MOBILE FIRST (320px+)
   ============================================ */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Decorative background elements */
.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

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

/* ============================================
   LOGIN CARD
   ============================================ */
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1.5rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

/* ============================================
   LOGIN HEADER
   ============================================ */
.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    margin-bottom: 1rem;
}

.login-logo img {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border-radius: var(--radius);
    object-fit: contain;
}

.login-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.login-tagline {
    font-size: clamp(0.75rem, 3vw, 0.875rem);
    color: var(--gray-500);
    font-weight: 400;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    animation: slideIn 0.3s ease-out;
}

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

.alert-danger {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ============================================
   FORM STYLES
   ============================================ */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    display: block;
}

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

.input-icon {
    position: absolute;
    left: 0.875rem;
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    pointer-events: none;
    z-index: 1;
    transition: var(--transition);
}

.form-control {
    width: 100%;
    height: 48px;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: var(--transition);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.form-control::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.form-control:hover {
    border-color: var(--gray-300);
    background-color: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

/* Password toggle button */
.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    z-index: 1;
}

.toggle-password:hover {
    color: var(--gray-600);
    background-color: var(--gray-100);
}

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

.toggle-password .hidden {
    display: none;
}

.toggle-password.active .eye-icon {
    display: none;
}

.toggle-password.active .eye-off-icon {
    display: block;
}

/* ============================================
   FORM OPTIONS (Remember me + Forgot password)
   ============================================ */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
}

.checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: var(--transition);
    position: absolute;
    top: 1px;
}

.remember-me input[type="checkbox"]:checked + .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.remember-me input[type="checkbox"]:checked + .checkmark::after {
    transform: rotate(45deg) scale(1);
}

.remember-me input[type="checkbox"]:focus + .checkmark {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.remember-text {
    font-size: 0.875rem;
}

.forgot-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

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

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    transition: var(--transition-slow);
    font-family: inherit;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.btn-primary {
    color: var(--white);
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-block {
    width: 100%;
    padding: 0.875rem 1.5rem;
    height: 52px;
    font-size: 1.0625rem;
}

.btn-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

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

/* ============================================
   LOGIN FOOTER
   ============================================ */
.login-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.signup-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

.signup-link {
    font-weight: 700;
    color: var(--primary);
}

.signup-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--gray-400);
    font-weight: 500;
    transition: var(--transition);
}

.admin-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.admin-link:hover {
    color: var(--gray-600);
}

.admin-link:hover svg {
    transform: translateX(-3px);
}

/* ============================================
   COPYRIGHT
   ============================================ */
.login-copyright {
    text-align: center;
    margin-top: 1.5rem;
    padding: 0 1rem;
}

.login-copyright p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.security-badge svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   TABLET BREAKPOINT (481px - 768px)
   ============================================ */
@media (min-width: 481px) {
    .login-wrapper {
        max-width: 440px;
    }

    .login-card {
        padding: 2rem;
        border-radius: var(--radius-xl);
    }

    .login-logo img {
        width: 70px;
        height: 70px;
    }

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

    .form-control {
        height: 52px;
        font-size: 1.0625rem;
    }

    .btn-block {
        height: 56px;
        font-size: 1.125rem;
    }
}

/* ============================================
   DESKTOP BREAKPOINT (769px+)
   ============================================ */
@media (min-width: 769px) {
    .login-page {
        padding: 2rem;
    }

    .login-wrapper {
        max-width: 460px;
    }

    .login-card {
        padding: 2.5rem;
        border-radius: var(--radius-xl);
    }

    .login-header {
        margin-bottom: 2rem;
    }

    .login-logo img {
        width: 80px;
        height: 80px;
    }

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

    .login-tagline {
        font-size: 1rem;
    }

    .login-form {
        gap: 1.5rem;
    }

    .form-label {
        font-size: 0.9375rem;
    }

    .form-control {
        height: 56px;
        padding: 1rem 1rem 1rem 3rem;
        font-size: 1.0625rem;
    }

    .input-icon {
        left: 1rem;
        width: 22px;
        height: 22px;
    }

    .toggle-password {
        right: 1rem;
    }

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

    .form-options {
        margin-top: 0.25rem;
    }

    .remember-text,
    .forgot-link {
        font-size: 0.9375rem;
    }

    .btn-block {
        height: 60px;
        font-size: 1.125rem;
        margin-top: 0.5rem;
    }

    .login-footer {
        margin-top: 2rem;
        padding-top: 2rem;
    }

    .signup-text,
    .admin-link {
        font-size: 0.9375rem;
    }

    .login-copyright {
        margin-top: 2rem;
    }

    .login-copyright p {
        font-size: 0.8125rem;
    }
}

/* ============================================
   LARGE DESKTOP (1024px+)
   ============================================ */
@media (min-width: 1024px) {
    .login-wrapper {
        max-width: 480px;
    }

    .login-card {
        padding: 3rem;
    }

    .login-logo img {
        width: 90px;
        height: 90px;
    }

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

/* ============================================
   SMALL MOBILE OPTIMIZATION (320px - 374px)
   ============================================ */
@media (max-width: 374px) {
    .login-page {
        padding: 0.75rem;
    }

    .login-card {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .login-logo img {
        width: 50px;
        height: 50px;
    }

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

    .login-tagline {
        font-size: 0.75rem;
    }

    .form-control {
        height: 44px;
        font-size: 0.9375rem;
        padding-left: 2.5rem;
    }

    .input-icon {
        width: 18px;
        height: 18px;
        left: 0.75rem;
    }

    .btn-block {
        height: 48px;
        font-size: 1rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .forgot-link {
        align-self: flex-end;
    }
}

/* ============================================
   LANDSCAPE MODE ON MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .login-page {
        padding: 0.75rem;
        align-items: flex-start;
        overflow-y: auto;
    }

    .login-wrapper {
        margin: 0.5rem auto;
    }

    .login-card {
        padding: 1.25rem;
    }

    .login-header {
        margin-bottom: 1rem;
    }

    .login-logo img {
        width: 45px;
        height: 45px;
    }

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

    .login-form {
        gap: 1rem;
    }

    .form-control {
        height: 44px;
    }

    .btn-block {
        height: 48px;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1e293b;
        --gray-100: #0f172a;
        --gray-200: #334155;
        --gray-300: #475569;
        --gray-400: #64748b;
        --gray-500: #94a3b8;
        --gray-600: #cbd5e1;
        --gray-700: #e2e8f0;
        --gray-800: #f1f5f9;
        --gray-900: #f8fafc;
        --white: #1e293b;
    }

    .login-card {
        background: var(--white);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }

    .form-control {
        background-color: var(--gray-100);
        border-color: var(--gray-300);
        color: var(--gray-800);
    }

    .form-control:hover {
        background-color: var(--gray-200);
    }

    .form-control:focus {
        background-color: var(--gray-200);
    }

    .alert-danger {
        background-color: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.2);
    }

    .alert-success {
        background-color: rgba(16, 185, 129, 0.1);
        border-color: rgba(16, 185, 129, 0.2);
    }
}

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

    .login-wrapper {
        animation: none;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }

    .btn-primary {
        border-width: 3px;
    }

    .login-card::before {
        height: 6px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .login-page {
        background: white;
    }

    .login-card {
        box-shadow: none;
        border: 1px solid #000;
    }

    .toggle-password,
    .admin-link,
    .login-copyright {
        display: none;
    }
}
