/* Medical-themed Login Styles */
.login-body { 
    background: linear-gradient(135deg, #12233a 0%, #0f1f33 100%);
    background-attachment: fixed;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

/* Normal/Desktop mode - prevent scrolling and ensure proper centering */
@media (min-width: 769px) {
    .login-body {
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* Medical-themed tiled gradient background */
.login-body::before {
    content: '';
    position: fixed;
    inset: 0;
    /* subtle medical gradient tint */
    background:
        linear-gradient(135deg, rgba(37,99,235,0.10), rgba(56,189,248,0.10)),
        /* grid lines */
        repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 64px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 64px);
    mix-blend-mode: overlay;
    pointer-events: none;
}

.login-body::after {
    content: '';
    position: fixed;
    inset: 0;
    /* random mosaic: 5 medical-themed colors scattered across entire background */
    background:
        /* Color 1: Sky Blue (#60a5fa) */
        linear-gradient(#60a5fa33, #60a5fa33) 5% 15% / 72px 72px no-repeat,
        linear-gradient(#60a5fa33, #60a5fa33) 25% 45% / 64px 64px no-repeat,
        linear-gradient(#60a5fa33, #60a5fa33) 45% 75% / 80px 80px no-repeat,
        linear-gradient(#60a5fa33, #60a5fa33) 65% 25% / 68px 68px no-repeat,
        linear-gradient(#60a5fa33, #60a5fa33) 85% 55% / 72px 72px no-repeat,
        linear-gradient(#60a5fa33, #60a5fa33) 15% 85% / 64px 64px no-repeat,
        /* Color 2: Cyan (#38bdf8) */
        linear-gradient(#38bdf833, #38bdf833) 12% 32% / 68px 68px no-repeat,
        linear-gradient(#38bdf833, #38bdf833) 32% 62% / 76px 76px no-repeat,
        linear-gradient(#38bdf833, #38bdf833) 52% 12% / 64px 64px no-repeat,
        linear-gradient(#38bdf833, #38bdf833) 72% 82% / 72px 72px no-repeat,
        linear-gradient(#38bdf833, #38bdf833) 92% 22% / 68px 68px no-repeat,
        linear-gradient(#38bdf833, #38bdf833) 22% 92% / 64px 64px no-repeat,
        /* Color 3: Light Blue (#93c5fd) */
        linear-gradient(#93c5fd33, #93c5fd33) 8% 52% / 64px 64px no-repeat,
        linear-gradient(#93c5fd33, #93c5fd33) 28% 22% / 72px 72px no-repeat,
        linear-gradient(#93c5fd33, #93c5fd33) 48% 92% / 68px 68px no-repeat,
        linear-gradient(#93c5fd33, #93c5fd33) 68% 42% / 76px 76px no-repeat,
        linear-gradient(#93c5fd33, #93c5fd33) 88% 72% / 64px 64px no-repeat,
        linear-gradient(#93c5fd33, #93c5fd33) 18% 65% / 72px 72px no-repeat,
        /* Color 4: Blue (#3b82f6) */
        linear-gradient(#3b82f633, #3b82f633) 3% 38% / 76px 76px no-repeat,
        linear-gradient(#3b82f633, #3b82f633) 35% 8% / 64px 64px no-repeat,
        linear-gradient(#3b82f633, #3b82f633) 55% 68% / 72px 72px no-repeat,
        linear-gradient(#3b82f633, #3b82f633) 75% 38% / 68px 68px no-repeat,
        linear-gradient(#3b82f633, #3b82f633) 95% 88% / 64px 64px no-repeat,
        linear-gradient(#3b82f633, #3b82f633) 38% 78% / 76px 76px no-repeat,
        /* Color 5: Deep Sky (#0ea5e9) */
        linear-gradient(#0ea5e933, #0ea5e933) 18% 8% / 64px 64px no-repeat,
        linear-gradient(#0ea5e933, #0ea5e933) 42% 38% / 72px 72px no-repeat,
        linear-gradient(#0ea5e933, #0ea5e933) 62% 88% / 68px 68px no-repeat,
        linear-gradient(#0ea5e933, #0ea5e933) 82% 18% / 76px 76px no-repeat,
        linear-gradient(#0ea5e933, #0ea5e933) 28% 58% / 64px 64px no-repeat,
        linear-gradient(#0ea5e933, #0ea5e933) 58% 28% / 72px 72px no-repeat,
        /* subtle grid lines */
        repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 64px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 64px);
    pointer-events: none;
}

.login-container { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100vh;
    width: 100vw;
    padding: 20px; 
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* Normal/Desktop mode - perfect centering without scroll */
@media (min-width: 769px) {
    .login-container {
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        width: 100vw !important;
        max-width: none !important;
    }
}

/* remove old dotted overlay for cleaner tiled look */
.login-container::before { display: none; }

.login-card { 
    width: 100%; 
    max-width: 420px; 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 16px; 
    padding: 32px; 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0;
    flex-shrink: 0;
}

/* Normal/Desktop mode - no scroll needed, perfectly sized and centered */
@media (min-width: 769px) {
    .login-card {
        max-height: none !important;
        overflow-y: visible !important;
        padding: 36px !important;
        margin: 0 !important;
        position: relative !important;
        width: 100% !important;
        max-width: 420px !important;
    }
}

.login-header { 
    text-align: center; 
    margin-bottom: 24px; 
}

.login-header .logo { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 12px; 
    font-weight: 700; 
    font-size: 24px; 
    color: #2d3748;
    margin-bottom: 16px;
}

.logo-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    color: white;
    font-size: 20px;
}

/* Custom Heartbeat Logo */
.heartbeat-logo {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heart {
    position: relative;
    width: 20px;
    height: 18px;
    background: white;
    border-radius: 10px 10px 0 0;
    transform: rotate(-45deg);
    animation: heartbeat 1.5s ease-in-out infinite;
}

.heart:before,
.heart:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 18px;
    background: white;
    border-radius: 10px 10px 0 0;
}

.heart:before {
    top: -9px;
    left: 0;
    transform: rotate(90deg);
}

.heart:after {
    top: 0;
    left: 9px;
    transform: rotate(90deg);
}

.ecg-line {
    position: absolute;
    top: 50%;
    left: -8px;
    right: -8px;
    height: 2px;
    background: white;
    transform: translateY(-50%);
    z-index: 2;
}

.ecg-line:before {
    content: '';
    position: absolute;
    top: -3px;
    left: 2px;
    width: 2px;
    height: 8px;
    background: white;
}

.ecg-line:after {
    content: '';
    position: absolute;
    top: -6px;
    left: 6px;
    width: 2px;
    height: 14px;
    background: white;
}

@keyframes heartbeat {
    0% { transform: rotate(-45deg) scale(1); }
    25% { transform: rotate(-45deg) scale(1.1); }
    50% { transform: rotate(-45deg) scale(1); }
    75% { transform: rotate(-45deg) scale(1.05); }
    100% { transform: rotate(-45deg) scale(1); }
}

.pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.1); opacity: 0; }
}

.login-header h1 { 
    margin: 0 0 8px; 
    font-size: 28px; 
    font-weight: 600;
    color: #2d3748;
}

.login-header p { 
    margin: 0; 
    color: #718096; 
    font-size: 16px;
}

.login-form .form-group { 
    margin-bottom: 12px; 
}

.medical-input-group { 
    position: relative;
    display: flex; 
    align-items: center; 
    border-radius: 12px; 
    background: #fff;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.medical-input-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.medical-icon { 
    color: #667eea; 
    padding: 12px 12px 12px 16px;
    font-size: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-right: 1px solid #e2e8f0;
}

.medical-input-group input { 
    border: none; 
    outline: none; 
    width: 100%; 
    font-size: 16px; 
    padding: 12px 16px;
    background: transparent;
    color: #2d3748;
}

.medical-input-group input::placeholder {
    color: #a0aec0;
}

.password-toggle {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: #667eea;
}

.btn-medical {
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-medical:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-medical:active {
    transform: translateY(0);
}

.btn-full { 
    width: 100%; 
}

/* Form Labels */
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
}

/* Checkbox Styling */
.form-options {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #4a5568;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Alert Styling */
.alert {
    padding: 10px 12px;
    border-radius: 10px;
    margin: 8px 0 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    flex-shrink: 0;
}

.alert-error {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    color: #742a2a;
    border-left: 4px solid #e53e3e;
}

.alert-success {
    background: linear-gradient(135deg, #c6f6d5, #9ae6b4);
    color: #22543d;
    border-left: 4px solid #38a169;
}

/* Links */
.login-form a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-form a:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Links container */
.login-form-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.login-form-links-separator {
    color: #9ca3af;
}

/* Responsive Design */
/* Tablet and Mobile - allow scrolling if needed */
@media (max-width: 768px) {
    .login-body {
        overflow-y: auto;
        overflow-x: hidden;
        position: relative;
        height: auto;
        min-height: 100vh;
    }
    
    .login-container {
        padding: 20px;
        position: relative;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
    
    .login-card {
        padding: 24px;
        max-width: 450px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .login-header h1 {
        font-size: 26px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .login-body {
        overflow-y: auto;
        overflow-x: hidden;
        position: relative;
        height: auto;
        min-height: 100vh;
    }
    
    .login-container {
        padding: 12px;
        position: relative;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
    
    .login-card {
        padding: 20px;
        max-width: 100%;
        border-radius: 12px;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .login-header {
        margin-bottom: 20px;
    }
    
    .login-header h1 {
        font-size: 22px;
        margin-bottom: 6px;
    }
    
    .login-header p {
        font-size: 14px;
    }
    
    .login-header .logo {
        font-size: 18px;
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .heartbeat-logo {
        width: 20px;
        height: 20px;
    }
    
    .heart {
        width: 16px;
        height: 14px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .medical-input-group {
        border-radius: 10px;
        border-width: 1.5px;
    }
    
    .medical-icon {
        padding: 14px 12px 14px 16px;
        font-size: 15px;
    }
    
    .medical-input-group input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
        min-height: 44px; /* Touch-friendly minimum size */
    }
    
    .password-toggle {
        right: 12px;
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-medical {
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 10px;
        min-height: 44px; /* Touch-friendly minimum size */
    }
    
    .checkbox-label {
        font-size: 13px;
        gap: 10px;
    }
    
    .checkmark {
        width: 18px;
        height: 18px;
    }
    
    .alert {
        padding: 10px 12px;
        margin: 12px 0;
        font-size: 12px;
        gap: 8px;
    }
    
    .login-form-links {
        gap: 12px;
        font-size: 13px;
    }
    
    .login-form-links a {
        font-size: 13px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .login-container {
        padding: 8px;
    }
    
    .login-card {
        padding: 16px;
    }
    
    .login-header h1 {
        font-size: 20px;
    }
    
    .login-header .logo {
        font-size: 16px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .medical-input-group input {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    .btn-medical {
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .login-container {
        align-items: flex-start;
        padding: 16px;
        padding-top: 20px;
    }
    
    .login-card {
        margin-top: 0;
        max-width: 500px;
    }
    
    .login-header {
        margin-bottom: 16px;
    }
    
    .login-header h1 {
        font-size: 22px;
        margin-bottom: 4px;
    }
    
    .login-header p {
        font-size: 13px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
}

@media (max-height: 600px) {
    .login-container {
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .login-card {
        margin-top: 20px;
    }
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal .modal-content {
        width: 95%;
        max-width: 500px;
        margin: 10px;
    }
    
    .modal .modal-content.modal-narrow {
        max-width: 95%;
    }
    
    .modal .modal-header {
        padding: 10px 14px;
    }
    
    .modal .modal-body {
        padding: 14px;
    }
    
    .stepper {
        gap: 4px;
        margin-bottom: 10px;
    }
    
    .step .label {
        font-size: 11px;
    }
    
    .form-row {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .modal .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .modal .modal-header {
        padding: 12px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .modal .modal-body {
        padding: 12px;
    }
    
    .stepper {
        margin-bottom: 12px;
    }
    
    .step {
        gap: 4px;
    }
    
    .step .dot {
        width: 8px;
        height: 8px;
    }
    
    .step .label {
        font-size: 10px;
    }
    
    .divider {
        height: 1px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 14px;
        min-height: 44px; /* Touch-friendly minimum size */
    }
    
    .input-wrapper .form-input {
        padding-left: 40px;
    }
    
    .input-wrapper .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .actions .btn {
        min-height: 44px; /* Touch-friendly minimum size */
        font-size: 15px;
    }
    
    .radio-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .radio {
        width: 100%;
        padding: 12px;
        min-height: 44px; /* Touch-friendly minimum size */
    }
    
    .actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .actions .btn {
        width: 100%;
    }
}

/* Modal basics (shared look) */
.modal { 
    position: fixed; 
    inset: 0; 
    background: rgba(0, 0, 0, 0.35); 
    display: none; 
    align-items: center; 
    justify-content: center; 
    z-index: 1000; 
}

.modal.show {
    display: flex;
}

.modal .modal-content { 
    background: #fff; 
    border-radius: 12px; 
    border: 1px solid #e5e7eb; 
    padding: 0 0 12px; 
    width: 95%; 
    max-width: 560px; 
    max-height: 90vh;
    overflow-y: auto;
}

.modal .modal-content.modal-narrow { 
    max-width: 520px; 
}

.modal .modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 16px; 
    border-bottom: 1px solid #e5e7eb; 
}

.modal .modal-body { 
    padding: 16px; 
}

.modal .close { 
    background: none; 
    border: none; 
    font-size: 22px; 
    line-height: 1; 
    cursor: pointer; 
    color: #6b7280; 
    transition: color 0.2s ease;
}

.modal .close:hover {
    color: #374151;
}

/* Input wrapper with small eye */
.input-wrapper { position:relative; display:flex; align-items:center; }
.input-wrapper .input-icon { position:absolute; left:10px; color:#9ca3af; }
.input-wrapper .form-input { width:100%;  padding:10px 12px; border:1px solid #e5e7eb; border-radius:8px; }
.input-wrapper .form-input:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,.1); outline:none; }
.input-wrapper .icon-btn { position:absolute; right:8px; top:50%; transform:translateY(-50%); width:24px; height:24px; display:flex; align-items:center; justify-content:center; color:#6b7280; background:transparent; border:none; cursor:pointer; }
.input-wrapper .icon-btn i { font-size:13px; }

.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-row.single { grid-template-columns:1fr; }
.actions { display:flex; gap:8px; justify-content:flex-end; margin-top: 10px; }
.is-hidden { display:none; }
.form-group label { display:block; font-size:13px; margin-bottom:6px; color:#374151; }
/* Duplicate alert styles removed; base and variants are defined earlier for consistency */

/* Stepper */
.stepper { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.step { flex:1; display:flex; align-items:center; gap:8px; }
.step .dot { width:10px; height:10px; border-radius:9999px; background:#d1d5db; }
.step.active .dot { background:#3b82f6; }
.step .label { font-size:12px; color:#6b7280; white-space:nowrap; }
.step.active .label { color:#374151; font-weight:600; }
.divider { flex:1; height:2px; background:#e5e7eb; border-radius:9999px; }

/* Radios, muted, countdown */
.radio-row { display:flex; gap:12px; }
.radio { display:flex; align-items:center; gap:6px; padding:8px 10px; border:1px solid #e5e7eb; border-radius:8px; cursor:pointer; }
.radio input { margin:0; }
.muted { color:#6b7280; font-size:12px; }
.countdown { font-size:12px; color:#6b7280; margin-left:8px; }

.field-error { color:#dc2626; font-size:12px; margin-top:4px; display:block; }
.form-group.error .form-input { border-color:#fca5a5; box-shadow:0 0 0 3px rgba(252,165,165,.2); }
.btn[disabled], .btn:disabled { background:#9ca3af !important; border-color:#9ca3af !important; cursor:not-allowed !important; opacity:0.9; }

