/* =============================================================================
   Epic FHIR App — Styles
   ============================================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.container { width: 100%; min-height: 100%; }

.card {
    background: white;
    border-radius: 0;
    padding: 30px;
    min-height: 100%;
    box-shadow: none;
}

.btn {
    background: #667eea; color: white; border: none;
    padding: 12px 24px; border-radius: 6px; font-size: 16px;
    cursor: pointer; transition: all 0.3s;
}
.btn:hover { background: #5568d3; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }

/* Patient Info Grid */
.patient-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-top: 20px; }
.info-item { padding: 15px; background: #f7fafc; border-radius: 6px; border-left: 3px solid #667eea; }
.info-label { font-size: 12px; color: #718096; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.info-value { font-size: 16px; color: #2d3748; font-weight: 500; }

/* Observation Items */
.observation-item { padding: 15px; background: #f7fafc; border-radius: 6px; margin-bottom: 10px; border-left: 3px solid #48bb78; }
.observation-code { font-weight: 600; color: #2d3748; margin-bottom: 5px; }
.observation-value { color: #4a5568; font-size: 18px; font-weight: 500; }
.observation-date { color: #718096; font-size: 12px; margin-top: 5px; }

/* Section Titles */
.section-title { font-size: 20px; color: #2d3748; margin: 25px 0 15px 0; padding-bottom: 10px; border-bottom: 2px solid #e2e8f0; }
.hidden { display: none !important; }

/* Loading Spinner */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#loading-section {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 400px; padding: 40px; text-align: center;
}
.spinner {
    width: 40px; height: 40px;
    border: 4px solid #e2e8f0; border-top: 4px solid #3182ce;
    border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 20px;
}

/* Error Section */
#error-section {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 400px; padding: 40px; text-align: center;
    background: #fff5f5; border: 1px solid #fed7d7; border-radius: 8px; margin: 20px 0;
}
#error-section h2 { font-size: 24px; color: #2d3748; margin-bottom: 15px; }
#error-section p { font-size: 16px; color: #4a5568; max-width: 500px; line-height: 1.5; }
#error-section ul { text-align: left; margin-top: 15px; }
#error-section li { margin: 8px 0; color: #4a5568; }

/* Autoantibody Grid */
.autoantibody-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 160px);
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

@media (min-width: 601px) and (max-width: 950px) {
    .autoantibody-grid {
        display: flex;
        flex-wrap: wrap;
        max-width: 500px; /* 3×160px + 2×10px gaps */
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }
    .autoantibody-grid > div {
        flex: 0 0 160px;
    }
}

@media (max-width: 600px) {
    .autoantibody-grid {
        display: flex;
        flex-wrap: wrap;
        max-width: 330px; /* 2×160px + 1×10px gap */
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }
    .autoantibody-grid > div {
        flex: 0 0 160px;
    }
}
