/* ============================================================ */
/*  login.css  –  Milchar Pharma Login Page                    */
/* ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700&display=swap');

/* ─── RESET ─────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

/* ─── BODY ───────────────────────────────────────────────── */
body {
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport height for mobile browsers */
    background: url('../images/img_2.png') no-repeat center center / cover;
    background-attachment: fixed; /* prevents background jump on mobile scroll */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 16px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    z-index: 0;
}

/* ─── WRAPPER ────────────────────────────────────────────── */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 430px;
    padding: 0;           /* removed — body now handles padding */
}

/* ─── CARD ───────────────────────────────────────────────── */
.login-card {
    background: #fff;
    padding: 44px 40px;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
    animation: fadeInUp 0.7s ease-in-out;
    width: 100%;
}

/* ─── LOGO ───────────────────────────────────────────────── */
.logo-section {
    text-align: center;
    margin-bottom: 30px;
}

.logo-image img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.logo-section h2 {
    margin-top: 14px;
    font-size: 1.45rem;
    font-weight: 700;
    color: #1B4F72;
}

.logo-section p {
    font-size: 13px;
    color: #aaa;
    margin-top: 5px;
}

/* ─── FLASH ALERTS ───────────────────────────────────────── */
.alert {
    padding: 13px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    animation: slideDown 0.4s ease;
    word-break: break-word;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* ─── INPUT GROUP ────────────────────────────────────────── */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    width: 17px;
    height: 17px;
    color: #bbb;
    pointer-events: none;
    flex-shrink: 0;
}

.input-icon-wrap input {
    width: 100%;
    padding: 13px 45px 13px 42px;
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    transition: all 0.3s ease;
    outline: none;
    /* Prevent iOS zoom on focus (font-size must be >= 16px or use this) */
    -webkit-text-size-adjust: 100%;
}

/* iOS zoom fix: bump font to 16px on small screens */
@media (max-width: 480px) {
    .input-icon-wrap input {
        font-size: 16px;
    }
}

.input-icon-wrap input:focus {
    border-color: #1B4F72;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(27, 79, 114, 0.1);
}

.input-icon-wrap input::placeholder {
    color: #ccc;
    font-weight: 400;
}

/* ─── PASSWORD TOGGLE ────────────────────────────────────── */
.toggle-pw {
    position: absolute;
    right: 13px;
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    display: flex;
    align-items: center;
    padding: 8px;          /* larger tap target on mobile */
    transition: color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.toggle-pw svg {
    width: 17px;
    height: 17px;
}

.toggle-pw:hover { color: #1B4F72; }

/* ─── LOGIN BUTTON ───────────────────────────────────────── */
.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: linear-gradient(135deg, #1B4F72 0%, #2980b9 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    letter-spacing: 0.4px;
    /* Larger tap target on mobile */
    min-height: 50px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.login-btn:hover {
    background: linear-gradient(135deg, #154360 0%, #1a6fa8 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(27, 79, 114, 0.35);
}

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

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

.login-btn.loading .btn-text  { display: none; }
.login-btn.loading .spinner   { display: block; }

/* ─── FOOTER ─────────────────────────────────────────────── */
.footer-note {
    text-align: center;
    font-size: 12px;
    color: #ccc;
    margin-top: 24px;
}

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

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

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

/* ─── RESPONSIVE: SMALL PHONES (≤ 480px) ────────────────── */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;      /* let card sit near top on small screens */
        padding-top: max(24px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .login-wrapper {
        /* full width on tiny screens */
        max-width: 100%;
    }

    .login-card {
        padding: 32px 20px 28px;
        border-radius: 14px;
    }

    .logo-image img {
        width: 72px;
        height: 72px;
    }

    .logo-section h2 {
        font-size: 1.25rem;
    }

    .logo-section {
        margin-bottom: 22px;
    }

    .input-group {
        margin-bottom: 16px;
    }

    .input-icon-wrap input {
        padding: 12px 44px 12px 42px;
    }

    .login-btn {
        font-size: 14px;
        padding: 13px;
    }

    .footer-note {
        font-size: 11px;
        margin-top: 18px;
    }
}

/* ─── RESPONSIVE: VERY SMALL (≤ 360px) ──────────────────── */
@media (max-width: 360px) {
    .login-card {
        padding: 26px 16px 22px;
    }

    .logo-image img {
        width: 62px;
        height: 62px;
    }

    .logo-section h2 {
        font-size: 1.1rem;
    }
}

/* ─── RESPONSIVE: TABLET (481px – 768px) ────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 20px;
    }

    .login-card {
        padding: 40px 36px;
    }
}

/* ─── LANDSCAPE MODE ON MOBILE ───────────────────────────── */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 16px;
    }

    .logo-section {
        margin-bottom: 16px;
    }

    .logo-image img {
        width: 56px;
        height: 56px;
    }

    .logo-section h2 {
        font-size: 1.1rem;
        margin-top: 8px;
    }

    .logo-section p {
        display: none;   /* hide subtitle in landscape to save space */
    }

    .login-card {
        padding: 24px 28px 20px;
    }

    .input-group {
        margin-bottom: 14px;
    }

    .footer-note {
        margin-top: 14px;
    }
}