:root {
    /* Premium Corporate Blue Palette */
    --bg-page: #e6f2ff;
    --bg-card: #FFFFFF;
    --text-main: #0F172A;       
    --text-secondary: #01184e;  
    --text-muted: #64748B;      
    
    --brand-primary: #1E40AF;   
    --accent-blue: #2563EB;     
    --accent-blue-hover: #1D4ED8;
    --border-light: #E2E8F0;    

    /* Status Colors */
    --status-pending-bg: #FEF3C7;  
    --status-pending-txt: #B45309; 
    --status-ready-bg: #DCFCE7;    
    --status-ready-txt: #15803D;   
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    padding: 0 0 40px 0; 
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Hard safety check against screen bleeding */
}

.title-text {
  text-transform: capitalize; /* Output: "Welcome To My Website" */
}

/* Clinic Header Banner */
.clinic-header {
    background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 100%);
    color: #FFFFFF;
    padding: 32px 16px 48px 16px;
    text-align: center;
}

.clinic-name {
    font-size: clamp(1.20rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    margin-bottom: 6px;
    line-height: 1.2;
}

.clinic-sub {
    font-size: 0.85rem;
    color: #bcdbfd; 
}
.clinic-sub2 {
    font-size: 0.75rem;
    color: #bcdbfd;    
}

/* Main Dashboard Layout Bounds */
.dashboard-container {
    width: 100%;
    max-width: 1100px;
    margin: -24px auto 0 auto; 
    padding: 0 16px;
}

/* Patient Details Block */
.patient-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    border: 1px solid rgba(255,255,255,0.7);
}

.meta-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.meta-group.full-width {
    grid-column: span 2;
    border-top: 1px dashed var(--border-light);
    padding-top: 12px;
    margin-top: 4px;
}

.meta-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 768px) {
  .meta-value {
    font-weight: 800;
  }
}

/* Section Heading */
.section-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 700;
    padding-left: 4px;
}

/* Main Cards Wrapper */
.test-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
}

/* Redesigned Test Item Box */
.test-item {
    background-color: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-light);
    
    display: grid;
    grid-template-columns: 1fr; /* Stacks layout elements reliably */
    gap: 14px;
    width: 100%;
    min-width: 0; /* Prevents cell blowout */
}

/* Strict Grid Header Area to secure the text sizing */
.test-top-row {
    display: grid;
    grid-template-columns: 1fr auto; /* Name takes left, badge takes exact right size */
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.test-info {
    min-width: 0; /* Forces sub-layout blocks to handle text overflow */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.test-name {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    font-weight: 700;
    color: var(--text-main);
    
    /* Pure Single Line Cutoff Blueprint */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.test-date-wrapper {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge.pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-txt);
}


.badge.ready {
    background-color: var(--status-ready-bg);
    color: var(--status-ready-txt);
}

/* Download Row container */
.card-actions {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    width: 100%;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    width: 100%; 
    text-decoration: none;
    transition: background-color 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}

.btn-download.active {
    background-color: var(--accent-blue);
    color: #FFFFFF;
}

.btn-download.active:hover {
    background-color: var(--accent-blue-hover);
}

.btn-download.disabled {
    background-color: #F1F5F9;
    color: #94A3B8;
    cursor: not-allowed;
}

.btn-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ==========================================================================
    DESKTOP RESPONSIVE ADAPTATION (Wider view ports)
    ========================================================================== */
@media (min-width: 768px) {
    .patient-card {
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    }

    .meta-group.full-width {
    grid-column: span 1;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    }

    /* Transitions layout smoothly into a clean double-column grid system */
    .test-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    }
}

/*--------------------------------------------------------------
# Back to top button
--------------------------------------------------------------*/
html {
    scroll-behavior: smooth;
}

.back-to-top {
    position: fixed;
    bottom: 50px;
    right: 10px;
    width: 40px;
    height: 40px;
    background-color: #6b6b6b;
    color: #e6f2ff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s, visibility 0.3s, background-color 0.2s;
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

/* Hover interaction */
.back-to-top:hover {
    background-color: #1e3faa;
    color: #FFFFFF;
}

.back-to-top:active {
    background-color: #000000;
}

/* Class toggled by JavaScript to show the button */
.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/*----------------- FOOTER ---------------------------------------------*/

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #333;
    color: white;
    text-align: center;
    
    /* Crucial changes for slimness and short line spacing */
    padding: 6px 0;      /* Reduced top/bottom padding makes ribbon slim */
    line-height: 1.2;    /* Tightens the spacing between lines of text */
  }

  /* Target paragraphs inside the footer to remove default margins */
  footer p {
    margin: 2px 0;       /* Minimizes gaps between stacked sentences */
    font-size: 13px;     /* Optional: slightly smaller text looks cleaner */
  }
  
  body {
    margin-bottom: 45px; /* Reduced to match the slimmer footer */
  }

  footer a {
    color: #FFFFFF;          /* Initial text color */
    text-decoration: none;   /* Removes default underline */
    transition: all 0.3s ease; /* Makes the hover change smooth, not instant */
}

/* Hover style: changes color and adds a clean underline */
footer a:hover {
  color: #00fff2;          /* Changes to a brighter color on hover */
  text-decoration: underline; /* Adds underline back on hover */
  opacity: 0.8;            /* Slightly dims the link for a modern feel */
}