@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --secondary: #10b981;
    --dark: #0f172a;
    --light: #f8fafc;
    --surface: #ffffff;
    --text: #334155;
    --text-light: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--light);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Authentication Layout */
.auth-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -200px;
    left: -200px;
    filter: blur(80px);
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    width: 100%;
    max-width: 400px;
    z-index: 10;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    color: var(--dark);
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* App Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 20;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    height: 70px;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-header .icon {
    font-size: 1.5rem;
    color: var(--secondary);
}

.nav-links {
    padding: 1rem 0;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    gap: 1rem;
    border-left: 3px solid transparent;
}

.nav-link i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.nav-link:hover,
.nav-link.active {
    background: var(--light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-link.active {
    background: rgba(37, 99, 235, 0.05);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

.topbar {
    height: 70px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content-area {
    padding: 2rem;
    flex-grow: 1;
}

/* Typography & Utilities */
h1.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1.5rem;
}

/* Forms & Buttons */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-light);
    background-color: #f8fafc;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #4ade80;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-right: 1.5rem;
}

.stat-icon.primary {
    background: #dbeafe;
    color: var(--primary);
}

.stat-icon.success {
    background: #dcfce7;
    color: var(--secondary);
}

.stat-icon.warning {
    background: #fef3c7;
    color: var(--warning);
}

.stat-icon.danger {
    background: #fee2e2;
    color: var(--danger);
}

.stat-details h3 {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.stat-details .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
}

/* Mobile Responsiveness */
.sidebar-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--dark);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Guest Health Records Styles */
.health-banner {
    background: #eef2eb;
    /* Apollo light green tint */
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border: 1px solid #d1dbca;
    position: relative;
    overflow: hidden;
}

.banner-content {
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.banner-image {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.15;
    /* Reduced opacity so text and button remain readable */
    z-index: 1;
}

.health-banner h2 {
    color: #435b31;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.health-banner .btn-dark-green {
    background: #3c542c;
    color: white;
    border-radius: var(--radius);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
}

.health-banner .btn-dark-green:hover {
    background: #2a3d1e;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.record-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f0f0;
    position: relative;
    transition: box-shadow 0.2s;
}

.record-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.record-type {
    display: inline-block;
    background: #e8f4fd;
    /* Light blue */
    color: #0b5b8c;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.record-date {
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
}

.record-body p {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

.record-body p strong {
    color: var(--dark);
    font-weight: 600;
    min-width: 100px;
    display: inline-block;
}

.record-actions {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.record-actions .btn-outline {
    background: #166534;
    color: white;
    border: 1px solid #166534;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.record-actions .btn-outline:hover {
    background: #14532d;
}

.record-actions .btn-solid {
    background: #106f9d;
    color: white;
    border: 1px solid #106f9d;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.record-actions .btn-solid:hover {
    background: #0b5b8c;
}

@media (max-width: 768px) {
    .health-banner {
        padding: 1rem;
    }

    .banner-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .record-actions {
        position: static;
        margin-top: 1.5rem;
        justify-content: flex-start;
        width: 100%;
        flex-direction: row;
        gap: 0.5rem;
    }

    .record-actions .btn {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
    }

    .record-header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        /* Allows wrapping if content is too large, but attempts inline first */
        column-gap: 0.5rem;
        row-gap: 0.5rem;
    }

    .record-header .record-type {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
        flex: 0 0 auto;
    }

    .record-header .record-date {
        font-size: 0.75rem;
        text-align: right;
        flex: 1 1 auto;
    }
}

/* Bill View Responsive Styles */
.page-header-responsive {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.bill-details-row {
    display: flex;
    justify-content: space-between;
}

.visit-info {
    text-align: right;
}

.bill-total-row {
    display: flex;
    justify-content: flex-end;
}

.bill-total-content {
    width: 300px;
}

@media (max-width: 768px) {
    .page-header-responsive {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .header-actions .btn {
        width: 100%;
        margin-right: 0 !important;
        justify-content: center;
    }

    .bill-details-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    .visit-info {
        text-align: left;
    }

    .bill-total-row {
        justify-content: flex-start;
    }

    .bill-total-content {
        width: 100%;
    }

    .bill-card {
        padding: 1rem !important;
    }

    .btn-text-mobile-hide {
        display: none;
    }

    .health-banner h2 {
        font-size: 1.25rem !important;
    }

    h1.page-title {
        font-size: 1.25rem !important;
        margin-bottom: 1rem !important;
    }
}