/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --tertiary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #000;
    --text-secondary: #555;
    --text-light: #999;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.4);
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9ff;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ===== BACKGROUND & ANIMATIONS ===== */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    z-index: -2;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.95;
    }
}

.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(40px);
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: #f093fb;
    top: -50px;
    right: -80px;
    animation: float 20s infinite ease-in-out;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: #764ba2;
    bottom: -70px;
    left: -50px;
    animation: float 25s infinite ease-in-out reverse;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: #4facfe;
    top: 50%;
    right: 10%;
    animation: float 22s infinite ease-in-out;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(30px);
    }
}

/* ===== NAVBAR ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.5rem;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo svg {
    color: #f5576c;
}

.nav-info {
    flex: 1;
}

.nav-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* ===== FORM SECTION ===== */
.form-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.form-title {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.emergency-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.label-icon {
    font-size: 1.25rem;
}

.form-input,
.select-input {
    padding: 1rem;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-input:focus,
.select-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:hover,
.select-input:hover {
    border-color: #667eea;
}

.select-input option {
    background: white;
    color: var(--text-primary);
    font-weight: 500;
}

.submit-btn {
    padding: 1.2rem 2rem;
    background: var(--secondary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(245, 87, 108, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.submit-btn:hover .btn-icon {
    transform: translateX(5px);
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.3s ease;
}

.loading-screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
}

.loading-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border: 3px solid transparent;
    border-top-color: #667eea;
    border-right-color: #764ba2;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 2s linear infinite;
}

.pulse-ring:nth-child(2) {
    width: 70px;
    height: 70px;
    border-top-color: #f093fb;
    border-right-color: #f5576c;
    animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.pulse-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--secondary-gradient);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(245, 87, 108, 0.6);
}

.loading-text {
    font-size: 1.8rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.loading-subtext {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: var(--secondary-gradient);
    border-radius: 3px;
    animation: progressAnimation 2s ease-in-out forwards;
}

@keyframes progressAnimation {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-percent {
    font-weight: 700;
    color: #667eea;
}

/* ===== RESULTS SECTION ===== */
.results-section {
    display: none;
    animation: slideInUp 0.6s ease-out;
}

.results-section.active {
    display: block;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-title {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.results-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    width: 100%;
    font-weight: 500;
}

.back-btn {
    padding: 0.75rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

/* ===== AI CONFIDENCE BADGE ===== */
.ai-confidence-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    justify-content: center;
}

.confidence-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.confidence-score {
    font-size: 1.5rem;
    background: var(--tertiary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.confidence-desc {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== HOSPITALS CONTAINER ===== */
.hospitals-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.hospital-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.hospital-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.hospital-card:hover::before {
    left: 100%;
}

.hospital-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow);
}

.hospital-card.best-option {
    border-color: rgba(245, 87, 108, 0.5);
    background: linear-gradient(135deg, rgba(245, 87, 108, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
    box-shadow: 0 0 50px rgba(245, 87, 108, 0.3), var(--shadow-lg);
}

.best-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--secondary-gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.hospital-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.hospital-name {
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hospital-rank {
    background: var(--primary-gradient);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.hospital-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.badge-info {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.cost-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
}

.cost-low {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.cost-medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.cost-high {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.specialties {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.specialty-tag {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.action-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.select-hospital-btn {
    flex: 1;
    padding: 0.9rem 1.5rem;
    background: var(--secondary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.select-hospital-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(245, 87, 108, 0.3);
}

.select-hospital-btn:active {
    transform: translateY(0);
}

.route-btn {
    padding: 0.9rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
}

.route-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #667eea;
}

/* ===== EMERGENCY INFO ===== */
.emergency-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-md);
}

.info-icon {
    font-size: 2rem;
}

.info-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-text strong {
    color: var(--text-primary);
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    z-index: 300;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
    transition: bottom 0.3s ease;
}

.toast.show {
    bottom: 2rem;
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    font-size: 0.95rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .form-section {
        padding: 1.5rem;
    }

    .form-title {
        font-size: 1.8rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
    }

    .back-btn {
        width: 100%;
        text-align: center;
    }

    .hospital-card {
        padding: 1.5rem;
    }

    .hospital-name {
        font-size: 1.2rem;
    }

    .hospital-info {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
    }

    .select-hospital-btn,
    .route-btn {
        width: 100%;
    }

    .navbar {
        padding: 1rem;
    }

    .navbar-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .form-header {
        margin-bottom: 1.5rem;
    }

    .emergency-form {
        gap: 1.2rem;
    }

    .ai-confidence-badge {
        font-size: 0.9rem;
    }

    .confidence-score {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .form-title {
        font-size: 1.5rem;
    }

    .form-output {
        padding: 1rem;
    }

    .hospital-header {
        flex-direction: column;
    }

    .hospital-rank {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .submit-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .navbar-label {
        display: none;
    }

    .best-badge {
        top: 1rem;
        right: 1rem;
        padding: 0.35rem 0.75rem;
        font-size: 0.7rem;
    }
}

/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

/* ===== HIDDEN SECTION ===== */
.hidden {
    display: none !important;
}
