﻿
/* Merged, deduplicated stylesheet (preserves original behavior) */
/* Theme variables (includes green tones) */
:root {
    --primary: #3F84E5;
    --primary-dark: #2F6BC0;
    --primary-light: #69A1EC;
    --cream: #FFFFC6;
    --cream-1: #FFF8A8;
    --cream-2: #FFEF80;
    --crimson: #B20D30;
    --crimson-dark: #8E0C23;
    /* Added green tones */
    --green: #2c9845;
    --green-dark: #1E7A35;
    --green-light: #5CD675;
    --text: #1E1E1E;
    --outline: #CFCC6F;
    --shadow: rgba(0,0,0,.10);
    --r: 16px;
    --r-lg: 24px;
    --t: all .2s ease;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base page layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Decorative bubbles */
.bg-decoration {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,198,0.15);
    animation: float 6s ease-in-out infinite;
    filter: blur(1px);
}

    /* Positions & sizes for decorative bubbles */
    .bg-decoration:nth-child(1) {
        top: 10%;
        left: 10%;
        width: 200px;
        height: 200px;
        animation-delay: 0s;
    }

    .bg-decoration:nth-child(2) {
        top: 60%;
        right: 10%;
        width: 150px;
        height: 150px;
        animation-delay: 2s;
    }

    .bg-decoration:nth-child(3) {
        bottom: 10%;
        left: 20%;
        width: 100px;
        height: 100px;
        animation-delay: 4s;
    }

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-18px) scale(1.03);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Selection container (main card) */
.selection-container {
    background: var(--cream-1);
    border: 3px solid var(--outline);
    border-radius: var(--r-lg);
    padding: 2.25rem 1.75rem;
    box-shadow: 0 14px 28px var(--shadow);
    width: 100%;
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 10;
    animation: slideUp .6s ease-out;
}

/* App logo */
.app-logo {
    width: 90px;
    height: 80px;
    border-radius: var(--r);
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crimson);
    color: #FFF7DA;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 1px;
    box-shadow: 0 10px 20px rgba(178,13,48,.25);
    animation: pulse 2s ease-in-out infinite;
}

/* Titles & text */
.selection-title {
    font-size: 2.1rem;
    font-weight: 900;
    margin-bottom: .4rem;
    color: #152238;
    text-transform: uppercase;
}

.selection-subtitle {
    font-size: 1.05rem;
    color: #2a2a2a;
    opacity: .9;
    margin-bottom: 1.4rem;
    line-height: 1.55;
}

/* Form labels & inputs */
.input-label {
    display: block;
    text-align: left;
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: .3rem;
}

.user-input {
    width: 100%;
    padding: .8rem 1rem;
    border: 2px solid var(--outline);
    border-radius: var(--r);
    background: var(--cream-2);
    font-size: 1rem;
    transition: var(--t);
    outline: none;
}

    .user-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(63,132,229,.25);
        background: #FFE96A;
    }

/* Passcode area (hidden by default) */
.passcode-container {
    display: none;
    gap: .5rem;
    justify-content: center;
    margin-top: 1rem;
    animation: slideDown .3s ease-out;
}

.passcode-input {
    width: 50px;
    height: 50px;
    border: 2px solid var(--outline);
    border-radius: var(--r);
    font-size: 1.5rem;
    text-align: center;
    background: var(--cream-2);
    outline: none;
    -webkit-text-security: disc;
    transition: var(--t);
}

    .passcode-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(63,132,229,.25);
        transform: scale(1.05);
    }

/* Error */
.error-message {
    display: none;
    color: var(--crimson);
    font-size: .9rem;
    margin-top: .5rem;
}

/* Button groups */
.button-group {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: 1rem;
}

/* Primary button */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-radius: var(--r);
    padding: .8rem;
    font-weight: 900;
    box-shadow: 0 6px 0 var(--primary-dark);
    border: none;
    transition: var(--t);
}

    .btn-primary:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 var(--primary-dark);
    }

    .btn-primary:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Success (green) button */
.btn-success {
    background: var(--green);
    color: #fff;
    border-radius: var(--r);
    padding: .8rem;
    font-weight: 900;
    box-shadow: 0 6px 0 var(--green-dark);
    border: none;
    transition: var(--t);
}

    .btn-success:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 var(--green-dark);
    }

    .btn-success:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Secondary (crimson) button */
.btn-secondary {
    background: var(--crimson);
    color: #fff;
    border-radius: var(--r);
    padding: .8rem;
    font-weight: 900;
    border: none;
    box-shadow: 0 6px 0 var(--crimson-dark);
    transition: var(--t);
}

    .btn-secondary:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 var(--crimson-dark);
    }

/* Neubrutalist Loader Styles */
.loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.loader-overlay {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--t);
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: var(--cream);
    padding: 20px;
    border: 4px solid var(--primary);
    box-shadow: 8px 8px 0 var(--shadow);
    border-radius: var(--r-lg);
}

.loader-spinner {
    width: 80px;
    height: 80px;
    border: 10px solid var(--primary);
    border-top: 10px solid var(--crimson);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    box-shadow: 8px 8px 0 var(--shadow);
}

.loader-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 24px;
    font-weight: bold;
    color: var(--text);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 3px 3px 0 var(--shadow);
    transition: var(--t);
}

/* Hospital type page styles (cards) */
.hospital-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 769px) {
    .hospital-options {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Card */
.hospital-card {
    flex: 1;
    text-align: left;
    padding: 1.25rem;
    border-radius: var(--r);
    background: var(--primary);
    color: #F8FAFF;
    border: 3px solid var(--primary-dark);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--t);
    box-shadow: 0 8px 0 var(--primary-dark);
}

    .hospital-card:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 var(--primary-dark);
    }

    /* Alternate color for second card */
    .hospital-card:nth-child(2) {
        background: var(--green);
        border-color: var(--green-dark);
        box-shadow: 0 8px 0 var(--green-dark);
    }

        .hospital-card:nth-child(2):active {
            box-shadow: 0 2px 0 var(--green-dark);
        }

.hospital-title {
    font-size: 1.2rem;
    font-weight: 900;
    color: #FFFBEA;
    margin-bottom: .35rem;
    text-transform: uppercase;
}

.hospital-description {
    font-size: .98rem;
    color: #FFFFFF;
    opacity: .95;
    line-height: 1.45;
}

/* Back button & icon */
.back-button {
    display: block;
    margin: 1.4rem auto 0;
    padding: .85rem 1.5rem;
    border-radius: var(--r);
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    background: var(--cream-2);
    color: #1f1f1f;
    border: 3px solid var(--outline);
    transition: var(--t);
    box-shadow: 0 6px 0 #D6C95A;
}

    .back-button:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 #D6C95A;
    }

.back-icon {
    display: none;
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 44px;
    height: 44px;
    background: var(--cream-2);
    border: 3px solid var(--outline);
    border-radius: 12px;
    color: #1f1f1f;
    font-size: 1.5rem;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    transition: var(--t);
    z-index: 20;
    box-shadow: 0 6px 0 #D6C95A;
}

    .back-icon:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 #D6C95A;
    }

/* Responsive: Desktop tweaks */
@media screen and (min-width: 768px) {
    body {
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    }

    .loader-content {
        border-radius: var(--r-lg);
    }

    .loader-spinner {
        width: 80px;
        height: 80px;
        border: 10px solid var(--primary);
        border-top: 10px solid var(--crimson);
        animation-duration: 1.5s;
        box-shadow: 8px 8px 0 var(--shadow);
    }

    body {
        padding: 1rem;
    }
}

/* Responsive: Mobile layout */
@media screen and (max-width: 767px) {
    body {
        background: var(--cream-1) !important;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }

    .selection-container {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        height: 100dvh;
        height: calc(var(--vh, 1vh) * 100);
        min-height: 100svh;
        max-width: none;
        justify-content: center;
        display: flex;
        flex-direction: column;
        padding: 4rem 1rem 2rem;
    }

    .loader-content {
        border-radius: var(--r);
        padding: 15px;
    }

    .loader-spinner {
        width: 50px;
        height: 50px;
        border: 8px solid var(--primary-dark);
        border-top: 8px solid var(--crimson-dark);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        box-shadow: 4px 4px 0 var(--shadow);
    }

    .loader-text {
        font-family: 'Courier New', Courier, monospace;
        font-size: 18px;
        font-weight: bold;
        color: var(--text);
        letter-spacing: 1px;
        text-transform: uppercase;
        text-shadow: 2px 2px 0 var(--shadow);
        transition: var(--t);
    }

    .selection-title {
        font-size: 1.8rem;
    }

    .selection-subtitle {
        font-size: 1rem;
        margin-bottom: 1.2rem;
    }

    .app-logo {
        width: 90px;
        height: 80px;
        font-size: 1.8rem;
        margin-bottom: 1.1rem;
    }

    .bg-decoration {
        display: none;
    }

    .back-button {
        display: none;
    }

    .back-icon {
        display: block;
    }
}

/* Ultra-small phones */
@media (max-width: 380px) {
    .selection-container {
        padding: 3.5rem 1rem 1.25rem;
        height: 100vh;
        border-radius: 0;
    }

    .selection-title {
        font-size: 1.65rem;
    }

    .hospital-card {
        padding: 1rem;
    }

    .back-icon {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        line-height: 34px;
    }
}

/* PWA safe-areas */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .selection-container {
        margin-top: env(safe-area-inset-top);
    }
}