/* Main Styles - Hospital Pricing Transparency UI */

/* CSS Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --text-dark: #111827;
    --text-gray: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-gray);
}

/* Buttons */
button, .btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover, .btn:hover {
    background-color: var(--primary-dark);
}

button:disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--text-gray);
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: var(--error);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-success {
    background-color: var(--success);
}

.btn-success:hover {
    background-color: #059669;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Tables */
table {
    width: 100%;
    background-color: var(--bg-white);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

thead {
    background-color: var(--bg-light);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

tr:hover {
    background-color: var(--bg-light);
}

/* Cards */
.card {
    background-color: var(--bg-white);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Search Result Cards */
.results-grouped {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.results-grouped-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.06));
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 1rem;
}

.results-grouped-title {
    color: var(--text-dark);
    font-size: 1.05rem;
    font-weight: 700;
}

.results-grouped-subtitle {
    color: var(--text-gray);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.results-grouped-filter {
    color: var(--primary);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 9999px;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.hospital-group-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 1rem;
}

.hospital-group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hospital-group-name {
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 700;
}

.hospital-group-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
    color: var(--text-gray);
    font-size: 0.875rem;
}

.procedure-card-list {
    display: grid;
    gap: 0.85rem;
}

.procedure-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    padding: 1rem;
}

.procedure-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.procedure-name {
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
}

.procedure-meta {
    color: var(--text-gray);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.price-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}

.price-metric {
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: 0.75rem;
    padding: 0.7rem 0.8rem;
}

.price-metric-label {
    display: block;
    color: var(--text-gray);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.price-metric-value {
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.plan-prices {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.plan-prices-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    align-items: baseline;
}

.section-label {
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.plan-prices-top {
    color: var(--text-gray);
    font-size: 0.875rem;
}

.chip-row,
.badge-row,
.evidence-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.price-chip,
.summary-badge,
.evidence-badge,
.inline-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 9999px;
    padding: 0.42rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
}

.price-chip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--text-dark);
}

.price-chip.is-selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.price-chip-more,
.evidence-badge-more,
.inline-chip-more {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-gray);
}

.chip-label {
    font-weight: 700;
}

.chip-value {
    font-variant-numeric: tabular-nums;
}

.summary-badge,
.evidence-badge,
.inline-chip {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.evidence-badge {
    font-size: 0.76rem;
    padding: 0.32rem 0.6rem;
}

.inline-chip {
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
}

.inline-chip-evidence {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.sibling-locations {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.sibling-location-list {
    color: var(--text-gray);
    font-size: 0.875rem;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 1rem;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Error Messages */
.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.success-message {
    background-color: #d1fae5;
    color: #065f46;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .results-grouped-header,
    .hospital-group-header,
    .procedure-card-header,
    .plan-prices-header {
        flex-direction: column;
    }

    .price-metrics {
        grid-template-columns: 1fr;
    }

    .hospital-group-card,
    .procedure-card {
        padding: 0.85rem;
    }
}
