/* Base Styles */
body { 
    font-family: 'Inter', sans-serif; 
    background: linear-gradient(135deg, #E8F8F5 0%, #D5F3EF 50%, #C3EDE8 100%);
    min-height: 100vh;
    color: #1a1a1a;
}

/* Container Styling */
.max-w-7xl {
    max-width: 85% !important;
    box-shadow: 0 0.75rem 2rem rgba(78, 205, 196, 0.15);
    border: 0.0625rem solid rgba(78, 205, 196, 0.2);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1.25rem;
    backdrop-filter: blur(1.25rem);
}

/* Table Styling */
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: 0.125rem solid #000000;
}

th, td { 
    border: 0.0625rem solid #000000;
    padding: 0.5rem 0.4rem; 
    text-align: center; 
    vertical-align: middle; 
    word-wrap: break-word;
    height: auto;
    line-height: 1.3;
    color: #000000;
}

th { 
    background-color: #ffffff; 
    font-weight: 600; 
    font-size: 0.85rem;
    color: #000000;
    border: 0.0625rem solid #000000;
}

/* Alternating Row Colors */
#standardReadingsTable tr:nth-child(even),
#rfStandardReadingsTable tr:nth-child(even),
#sampleTableContainer tbody tr:nth-child(even) {
    background-color: #FBFDFB;
}

/* Input Styling */
label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1a1a;
}

input[type="text"], input[type="number"], select {
    padding: 0.3rem 0.4rem;
    font-size: 0.9rem;
    border: 0.125rem solid #B2DFDB;
    border-radius: 0.5rem;
    width: 100%;
    word-wrap: break-word;
    white-space: normal;
    height: auto;
    margin: 0;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #1a1a1a;
}

input[type="text"]:hover, input[type="number"]:hover, select:hover {
    border-color: #4ECDC4;
    background-color: #F8FDFC;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #4ECDC4;
    box-shadow: 0 0 0 0.1875rem rgba(78, 205, 196, 0.2);
    transform: scale(1.02);
}

/* Numeric Input Styling */
input[type="number"] { 
    -moz-appearance: textfield; 
    appearance: textfield;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    appearance: none;
    margin: 0; 
}

/* Section Titles */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    padding: 0.3rem 0.2rem;
    border-bottom: 0.125rem solid #e5e7eb;
    margin-bottom: 0.3rem;
}

/* Button Styling */
.calc-button {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-weight: 600;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
}

.calc-button:focus { 
    outline: none; 
}

.button-green {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    box-shadow: 0 0.25rem 1rem rgba(78, 205, 196, 0.3);
}

.button-green:hover {
    background: linear-gradient(135deg, #44A08D, #2E8B8B);
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.5rem rgba(78, 205, 196, 0.4);
}

.button-gray {
    background: linear-gradient(135deg, #FF6B6B, #FF5252);
    color: white;
    box-shadow: 0 0.25rem 1rem rgba(255, 107, 107, 0.3);
}

.button-gray:hover {
    background: linear-gradient(135deg, #FF5252, #F44336);
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.5rem rgba(255, 107, 107, 0.4);
}

.button-blue {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 0.25rem 1rem rgba(52, 152, 219, 0.3);
}

.button-blue:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.5rem rgba(52, 152, 219, 0.4);
}

/* Result Values */
.concentration-display {
    font-size: 0.8rem !important;
    font-weight: 600;
    color: #1a1a1a;
    padding: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Input Error */
.input-error {
    border-color: #FF6B6B;
    background-color: #FFEBEE;
}

/* Message Area */
#messageArea {
    margin-bottom: 1rem;
    padding: 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.75rem;
    border-left: 0.25rem solid #4ECDC4;
    background: linear-gradient(135deg, #F0F9F7, #E8F8F5);
    color: #1a1a1a;
}

/* Main Title */
.main-title {
    text-align: center;
    margin: 0 0 1.875rem 0;
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.3;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* Table Layout */
#standardDetailsTable {
    table-layout: fixed;
    width: 100%;
}

#standardDetailsTable td.name-col {
    width: 60%;
}

#standardDetailsTable td.data-col {
    width: 13.33%;
}

/* Utility Classes */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.font-medium { font-weight: 500 !important; }
.w-1\/6 { width: 16.666667% !important; }
.w-16 { width: 4rem !important; }
.w-24 { width: 6rem !important; }
.w-full { width: 100% !important; }
.ml-1 { margin-left: 0.25rem !important; }
.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.text-xs { font-size: 0.75rem !important; }
.flex { display: flex !important; }
.space-x-1 > * + * { margin-left: 0.25rem !important; }

/* Readings Table */
.readings-table {
    width: 100%;
    table-layout: fixed;
}

.readings-table th, 
.readings-table td {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
}

/* Standard Readings Table - Optimized for 9 columns */
#standardReadingsTable {
    width: 100%;
    table-layout: fixed;
}

#standardReadingsTable th,
#standardReadingsTable td {
    text-align: center;
    padding: 0.5rem 0.2rem;
    font-size: 0.8rem;
    word-wrap: break-word;
    white-space: normal;
}

/* Column width optimization for 9 columns (6 readings + 3 stats) */
#standardReadingsTable th:nth-child(-n+6),
#standardReadingsTable td:nth-child(-n+6) {
    width: 10%; /* Reading columns */
}

#standardReadingsTable th:nth-child(n+7),
#standardReadingsTable td:nth-child(n+7) {
    width: 13.33%; /* Stats columns (Average, Std Dev, % RSD) */
}

#standardReadingsTable input {
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.2rem;
}

/* RF Standard Readings Table - Optimized for 4 columns */
#rfStandardReadingsTable {
    width: 100%;
    table-layout: fixed;
}

#rfStandardReadingsTable th,
#rfStandardReadingsTable td {
    text-align: center;
    padding: 0.5rem 0.2rem;
    font-size: 0.8rem;
    word-wrap: break-word;
    white-space: normal;
}

/* Column width optimization for 4 columns (2 readings + 2 stats) */
#rfStandardReadingsTable th:nth-child(-n+2),
#rfStandardReadingsTable td:nth-child(-n+2) {
    width: 20%; /* Reading columns */
}

#rfStandardReadingsTable th:nth-child(3),
#rfStandardReadingsTable td:nth-child(3) {
    width: 25%; /* Average column */
}

#rfStandardReadingsTable th:nth-child(4),
#rfStandardReadingsTable td:nth-child(4) {
    width: 35%; /* Correlation column - wider for longer text */
}

#rfStandardReadingsTable input {
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.2rem;
}

/* Focus Styling */
td:has(input:focus) {
    background-color: #F0F9F7;
}

tbody tr:hover {
    background-color: #F0F9F7;
    transition: background-color 0.3s ease;
}

/* Excel-like Focus */
.excel-focus {
    outline: 3px solid #4ECDC4 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.3) !important;
    transform: scale(1.02) !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    z-index: 1000 !important;
}

.excel-focus::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid #4ECDC4;
    border-radius: 6px;
    pointer-events: none;
    animation: excelPulse 2s infinite;
}

@keyframes excelPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Highlight the row containing the focused element */
tr:has(.excel-focus) {
    background-color: rgba(78, 205, 196, 0.1) !important;
}

/* Enhanced focus for table cells */
td:has(.excel-focus) {
    background-color: rgba(78, 205, 196, 0.15) !important;
    border-color: #4ECDC4 !important;
}

/* Focus indicator for non-table inputs */
.excel-focus:not(td *) {
    background-color: rgba(78, 205, 196, 0.1) !important;
    border-color: #4ECDC4 !important;
}

/* Navigation hint tooltip */
.navigation-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navigation-hint.show {
    opacity: 1;
}

/* Keyboard shortcuts display */
.keyboard-shortcuts {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #4ECDC4;
    border-radius: 8px;
    padding: 15px;
    font-size: 12px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 250px;
}

.keyboard-shortcuts h4 {
    margin: 0 0 10px 0;
    color: #4ECDC4;
    font-weight: 600;
}

.keyboard-shortcuts .shortcut {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    padding: 3px 0;
}

.keyboard-shortcuts .key {
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 11px;
    font-weight: bold;
    color: #333;
}

.keyboard-shortcuts .description {
    color: #666;
    margin-left: 10px;
}

input:focus,
select:focus {
    border-color: #2196F3;
    outline: none;
    box-shadow: 0 0 0 0.125rem rgba(33, 150, 243, 0.3);
    background-color: #E3F2FD;
    transform: scale(1.01);
}

tr:hover {
    background-color: #F5F5F5;
    transition: background-color 0.2s ease;
}

tr:has(.excel-focus) {
    background-color: #E8F4FD;
}

.excel-focus::before {
    content: '';
    position: absolute;
    top: -0.0625rem;
    left: -0.0625rem;
    right: -0.0625rem;
    bottom: -0.0625rem;
    border: 0.125rem solid #2196F3;
    border-radius: 0.25rem;
    pointer-events: none;
    z-index: 2;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

input::placeholder {
    color: #999;
    font-style: italic;
}

/* Sample Table */
#sampleTableContainer table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #F0F9F7, #E8F8F5);
    padding: 0.3rem;
    font-size: 0.75rem;
}

#sampleTableContainer table td {
    padding: 0.2rem;
    font-size: 0.8rem;
}

#sampleTableContainer table th.w-10 { width: 1.875rem; }
#sampleTableContainer table th.w-16 { width: 6.25rem; }
#sampleTableContainer table th.w-24 { width: 7.5rem; }
#sampleTableContainer table th.w-20 { width: 2.8125rem; }
#sampleTableContainer table th.w-32 { width: 5rem; }

#sampleTableContainer table input {
    width: 100%;
    min-width: 0;
    word-wrap: break-word;
    white-space: normal;
    height: auto;
}

/* Print Styles - Default (Portrait) */
@media print {
    @page {
        size: A4 portrait;
        margin: 0.5cm;
    }
    
    body {
        width: 21cm;
        height: 29.7cm;
        margin: 0;
        padding: 0.5cm;
        font-size: 10pt;
    }
    
    #messageArea {
        display: none !important;
    }
    
    button, .calc-button, #addBatchButtonContainer, .flex.justify-center {
        display: none !important;
    }
    
    .max-w-7xl {
        max-width: 100% !important;
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: none;
    }
    
    table {
        margin-bottom: 0.3125rem !important;
        page-break-inside: avoid;
        font-size: 9pt;
    }
    
    th, td {
        border: 0.0625rem solid #000000 !important;
        padding: 0.2rem 0.3rem !important;
        line-height: 1.2 !important;
    }
    
    th {
        background-color: #e5e7eb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color: #000000 !important;
        font-weight: bold !important;
        font-size: 9pt !important;
    }
    
    .main-title {
        display: none;
    }
    
    input, select {
        border: none;
        padding: 0;
        font-size: 9pt;
    }
    
    .mb-2, .mb-4 {
        margin-bottom: 0.1rem !important;
    }
    
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    #reportFooter {
        margin-top: 0.5rem !important;
        padding-top: 0.5rem !important;
    }
    
    #reportFooter table {
        margin-bottom: 0 !important;
    }
    
    #reportFooter label {
        margin-bottom: 0 !important;
        font-size: 9pt !important;
    }
    
    #reportFooter input {
        padding: 0.1rem !important;
        height: 1.2rem !important;
    }
    
    #pageNumbers {
        position: fixed;
        bottom: 1cm;
        width: 100%;
        text-align: center;
        font-size: 10pt;
    }
    
    @page {
        @bottom-center {
            content: counter(page) " of " counter(pages);
        }
    }
}

/* Landscape Mode Styles */
@media print and (orientation: landscape) {
    @page {
        size: A4 landscape;
        margin: 0.3cm;
    }
    
    body {
        width: 29.7cm;
        height: 21cm;
        margin: 0;
        padding: 0.3cm;
        font-size: 8pt;
    }
    
    table {
        margin-bottom: 0.1875rem !important;
        font-size: 7pt;
    }
    
    th, td {
        padding: 0.1rem 0.2rem !important;
        line-height: 1 !important;
    }
    
    th {
        font-size: 7pt !important;
    }
    
    input, select {
        font-size: 7pt;
    }
    
    .mb-2, .mb-4 {
        margin-bottom: 0.05rem !important;
    }
    
    #reportFooter {
        margin-top: 0.3rem !important;
        padding-top: 0.3rem !important;
    }
    
    #reportFooter label {
        font-size: 7pt !important;
    }
    
    #reportFooter input {
        padding: 0.05rem !important;
        height: 1rem !important;
    }
    
    #pageNumbers {
        bottom: 0.5cm;
        font-size: 8pt;
    }
}

/* Print-only Elements */
.print-only {
    display: none;
}

@media print {
    .print-only {
        display: block;
    }
}

/* Background Colors */
td.text-left.font-medium,
td.font-medium,
th {
    background-color: #f3f7fb;
    color: #1a1a1a;
}

/* Responsive design for wider screens */
@media (min-width: 1400px) {
    .max-w-7xl {
        max-width: 88% !important;
    }
    
    #standardReadingsTable th,
    #standardReadingsTable td {
        padding: 0.4rem 0.3rem;
        font-size: 0.75rem;
    }
}

@media (min-width: 1600px) {
    .max-w-7xl {
        max-width: 90% !important;
    }
}

/* Result Values */
.concentration-display, 
#stdAvg, #stdStdDev, #stdRSD,
#rfStdAvg, #rfStdCorrelation,
[id^="sampleAvgReading_"], 
[id^="sampleAssay_"],
[id^="sampleAssayAvg_"] {
    font-size: 0.8rem;
}

/* Export Mode Selector */
#exportMode {
    background-color: white;
    border: 0.0625rem solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    width: 6.25rem;
    min-width: 6.25rem;
    max-width: 6.25rem;
}

#exportMode:hover {
    border-color: #80bdff;
}

#exportMode:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.125rem rgba(0, 123, 255, 0.25);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 0.625rem;
    }
    
    .max-w-7xl {
        max-width: 95% !important;
        padding: 0.9375rem;
        border-radius: 1rem;
    }
    
    .main-title {
        font-size: 1.8rem;
        margin-bottom: 1.25rem;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        border-radius: 0.5rem;
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.3rem 0.2rem;
        font-size: 0.75rem;
        min-width: 3.75rem;
    }
    
    input[type="text"], input[type="number"], select {
        padding: 0.2rem 0.3rem;
        font-size: 1rem; /* Prevents zoom on iOS */
        width: 90%;
    }
    
    .calc-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        margin: 0.5rem 0.25rem;
    }
    
    .concentration-display {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .max-w-7xl {
        max-width: 98% !important;
        padding: 0.625rem;
    }
    
    .main-title {
        font-size: 1.5rem;
    }
    
    th, td {
        padding: 0.2rem 0.1rem;
        font-size: 0.7rem;
        min-width: 3.125rem;
    }
    
    input[type="text"], input[type="number"], select {
        padding: 0.15rem 0.2rem;
        font-size: 1rem; /* Prevents zoom on iOS */
        width: 85%;
    }
    
    .calc-button {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
        margin: 0.375rem 0.125rem;
    }
}

/* Mobile-First Design for Screens Under 600px */
@media (max-width: 600px) {
    /* Base Layout Adjustments */
    body {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .max-w-7xl {
        max-width: 100% !important;
        padding: 0.75rem;
        margin: 0.25rem;
        border-radius: 0.75rem;
        box-shadow: 0 0.25rem 1rem rgba(78, 205, 196, 0.1);
    }
    
    /* Typography Adjustments */
    .main-title {
        font-size: 1.4rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        line-height: 1.2;
    }
    
    .section-title {
        font-size: 0.9rem;
        padding: 0.25rem 0.15rem;
        margin-bottom: 0.25rem;
    }
    
    /* Table Responsive Design */
    table {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        border-radius: 0.375rem;
    }
    
    th, td {
        padding: 0.25rem 0.15rem;
        font-size: 0.7rem;
        min-width: 2.5rem;
        word-wrap: break-word;
        white-space: normal;
    }
    
    /* Input Field Optimizations */
    input[type="text"], input[type="number"], select {
        padding: 0.375rem 0.25rem;
        font-size: 1rem; /* Prevents iOS zoom */
        border-radius: 0.375rem;
        border-width: 0.125rem;
        width: 100%;
        min-height: 2.5rem; /* Touch-friendly height */
    }
    
    input[type="text"]:focus, input[type="number"]:focus, select:focus {
        transform: scale(1.01);
        box-shadow: 0 0 0 0.125rem rgba(78, 205, 196, 0.3);
    }
    
    /* Button Improvements */
    .calc-button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        border-radius: 0.5rem;
        margin: 0.375rem 0.25rem;
        min-height: 2.75rem; /* Touch-friendly height */
        width: auto;
        min-width: 6rem;
    }
    
    /* Flexbox Layout Improvements */
    .flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .flex.justify-center {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    /* Export Controls - Stack Vertically */
    .flex.justify-center.mb-4 {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    #exportMode {
        width: 8rem;
        min-width: 8rem;
        max-width: 8rem;
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Organization Info Table - Stack Vertically */
    .mb-4 table {
        display: block;
    }
    
    .mb-4 table tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 0.5rem;
        border: 0.0625rem solid #000000;
        border-radius: 0.375rem;
        overflow: hidden;
    }
    
    .mb-4 table td {
        display: flex;
        align-items: center;
        padding: 0.375rem;
        border: none;
        border-bottom: 0.0625rem solid #e5e7eb;
    }
    
    .mb-4 table td:last-child {
        border-bottom: none;
    }
    
    .mb-4 table td:first-child {
        background-color: #f3f7fb;
        font-weight: 600;
        font-size: 0.8rem;
    }
    
    .mb-4 table td:nth-child(2) {
        padding-left: 0.75rem;
    }
    
    /* Standard Readings Table - Mobile Optimized */
    #standardReadingsTable,
    #rfStandardReadingsTable {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        border-radius: 0.375rem;
    }
    
    #standardReadingsTable th,
    #standardReadingsTable td,
    #rfStandardReadingsTable th,
    #rfStandardReadingsTable td {
        padding: 0.25rem 0.15rem;
        font-size: 0.65rem;
        min-width: 2.5rem;
    }
    
    #standardReadingsTable input,
    #rfStandardReadingsTable input {
        font-size: 0.875rem;
        padding: 0.25rem;
        min-height: 2rem;
    }
    
    /* Sample Table Container - Mobile Scroll */
    #sampleTableContainer {
        overflow-x: auto;
        border-radius: 0.375rem;
        border: 0.125rem solid #000000;
    }
    
    #sampleTableContainer table {
        min-width: 100%;
        font-size: 0.7rem;
    }
    
    #sampleTableContainer th,
    #sampleTableContainer td {
        padding: 0.25rem 0.15rem;
        min-width: 2.5rem;
        white-space: nowrap;
    }
    
    #sampleTableContainer input {
        font-size: 0.875rem;
        padding: 0.25rem;
        min-height: 2rem;
    }
    
    /* Content Uniformity Summary Table */
    .mb-4.no-print table {
        font-size: 0.75rem;
    }
    
    .mb-4.no-print th,
    .mb-4.no-print td {
        padding: 0.375rem 0.25rem;
        font-size: 0.7rem;
    }
    
    /* Result Values */
    .concentration-display,
    #stdAvg, #stdStdDev, #stdRSD,
    #rfStdAvg, #rfStdCorrelation,
    [id^="sampleAvgReading_"], 
    [id^="sampleAssay_"],
    [id^="sampleAssayAvg_"] {
        font-size: 0.75rem;
        padding: 0.25rem;
        font-weight: 600;
    }
    
    /* Message Area */
    #messageArea {
        margin-bottom: 0.75rem;
        padding: 0.5rem;
        font-size: 0.8rem;
        border-radius: 0.5rem;
    }
    
    /* Report Footer - Mobile Layout */
    #reportFooter {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
    
    #reportFooter table {
        display: block;
    }
    
    #reportFooter table tr {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #reportFooter table td {
        width: 100% !important;
        text-align: left !important;
        padding: 0.25rem 0;
    }
    
    #reportFooter label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    #reportFooter input {
        width: 100%;
        padding: 0.375rem;
        font-size: 0.875rem;
        min-height: 2.5rem;
    }
    
    /* Utility Classes for Mobile */
    .w-60 {
        width: 100% !important;
    }
    
    .w-28 {
        width: 100% !important;
        margin-top: 0.25rem;
    }
    
    .ml-2 {
        margin-left: 0 !important;
    }
    
    /* Hide less important elements on mobile */
    .text-xs {
        font-size: 0.7rem !important;
    }
    
    /* Improved touch targets */
    button, 
    input[type="button"], 
    input[type="submit"],
    select {
        min-height: 2.75rem;
        touch-action: manipulation;
    }
    
    /* Better spacing for mobile */
    .mb-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .p-6 {
        padding: 0.75rem !important;
    }
    
    .my-8 {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
}

/* Extra Small Mobile Devices (under 400px) */
@media (max-width: 400px) {
    body {
        padding: 0.25rem;
        font-size: 0.8rem;
    }
    
    .max-w-7xl {
        padding: 0.5rem;
        margin: 0.125rem;
    }
    
    .main-title {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    th, td {
        padding: 0.2rem 0.1rem;
        font-size: 0.65rem;
        min-width: 2rem;
    }
    
    input[type="text"], input[type="number"], select {
        padding: 0.25rem 0.2rem;
        font-size: 1rem;
        min-height: 2.25rem;
    }
    
    .calc-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 2.5rem;
    }
    
    .flex.justify-center {
        gap: 0.5rem;
    }
    
    #exportMode {
        width: 7rem;
        min-width: 7rem;
        max-width: 7rem;
    }
} 

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img:hover {
    transform: scale(1.02);
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
}

/* Responsive Image Container */
.image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
}

.image-container img {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-container:hover img {
    transform: scale(1.05);
}

/* Responsive Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.image-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Responsive Image Sizes */
.responsive-img-small {
    max-width: 150px;
    width: 100%;
}

.responsive-img-medium {
    max-width: 300px;
    width: 100%;
}

.responsive-img-large {
    max-width: 500px;
    width: 100%;
}

.responsive-img-full {
    width: 100%;
    max-width: none;
}

/* Aspect Ratio Containers */
.aspect-ratio-16-9 {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.aspect-ratio-4-3 {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.aspect-ratio-1-1 {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

.aspect-ratio-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lazy Loading Styles */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Image Placeholder */
.image-placeholder {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.875rem;
    min-height: 200px;
    border-radius: 0.5rem;
}

/* Mobile Responsive Images */
@media (max-width: 600px) {
    .image-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .image-grid img {
        height: 150px;
    }
    
    .responsive-img-small {
        max-width: 120px;
    }
    
    .responsive-img-medium {
        max-width: 250px;
    }
    
    .responsive-img-large {
        max-width: 100%;
    }
    
    img {
        border-radius: 0.25rem;
        box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.1);
    }
    
    .image-container {
        border-radius: 0.375rem;
    }
}

@media (max-width: 400px) {
    .image-grid img {
        height: 120px;
    }
    
    .responsive-img-small {
        max-width: 100px;
    }
    
    .responsive-img-medium {
        max-width: 200px;
    }
}

/* Print Styles for Images */
@media print {
    img {
        max-width: 100%;
        page-break-inside: avoid;
        box-shadow: none;
    }
    
    .image-container {
        break-inside: avoid;
    }
    
    .image-grid {
        display: block;
    }
    
    .image-grid img {
        margin-bottom: 0.5rem;
        height: auto;
    }
} 

/* Hamburger Menu Navigation */
.hamburger-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(78, 205, 196, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    min-height: 3.5rem;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

/* Hamburger Button */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    transform: scale(1.1);
}

.hamburger-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.3);
    border-radius: 0.25rem;
}

.hamburger-line {
    width: 100%;
    height: 0.125rem;
    background-color: #1a1a1a;
    border-radius: 0.0625rem;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger Animation */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(0.375rem, 0.375rem);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-100%);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(0.375rem, -0.375rem);
}

/* Navigation Menu */
.nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 1000;
}

.nav-menu.active {
    right: 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-top: 4rem;
}

.nav-item {
    border-bottom: 1px solid rgba(78, 205, 196, 0.1);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.1) 0%, rgba(78, 205, 196, 0.05) 100%);
    color: #4ECDC4;
    transform: translateX(0.5rem);
}

.nav-link:focus {
    outline: none;
    background: rgba(78, 205, 196, 0.1);
    box-shadow: inset 0 0 0 2px rgba(78, 205, 196, 0.3);
}

.nav-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    width: 1.5rem;
    text-align: center;
}

/* Navigation Footer */
.nav-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.05) 0%, rgba(78, 205, 196, 0.02) 100%);
    border-top: 1px solid rgba(78, 205, 196, 0.1);
}

.nav-info {
    text-align: center;
}

.nav-version {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0 0 0.25rem 0;
    font-weight: 500;
}

.nav-description {
    font-size: 0.8rem;
    color: #1a1a1a;
    margin: 0;
    font-weight: 600;
}

/* Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Active Navigation Link */
.nav-link.active {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.15) 0%, rgba(78, 205, 196, 0.1) 100%);
    color: #4ECDC4;
    border-left: 3px solid #4ECDC4;
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #4ECDC4;
}

/* Desktop Navigation (Hidden on mobile) */
@media (min-width: 768px) {
    .hamburger-nav {
        position: relative;
        background: transparent;
        border-bottom: none;
        box-shadow: none;
    }
    
    .nav-container {
        padding: 0;
    }
    
    .nav-header {
        display: none;
    }
    
    .nav-menu {
        position: static;
        width: auto;
        height: auto;
        max-width: none;
        background: transparent;
        box-shadow: none;
        overflow: visible;
        transform: none;
        right: auto;
    }
    
    .nav-menu.active {
        right: auto;
    }
    
    .nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0;
        margin: 1rem 0;
        justify-content: center;
    }
    
    .nav-item {
        border-bottom: none;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
        border: 1px solid rgba(78, 205, 196, 0.2);
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(10px);
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .nav-link:hover {
        background: rgba(78, 205, 196, 0.1);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(78, 205, 196, 0.2);
    }
    
    .nav-link.active {
        background: linear-gradient(135deg, #4ECDC4, #44A08D);
        color: white;
        border-color: #4ECDC4;
        box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
    }
    
    .nav-footer {
        display: none;
    }
    
    .nav-overlay {
        display: none;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    .nav-menu {
        max-width: 280px;
    }
    
    .nav-link {
        padding: 0.875rem 1.25rem;
        font-size: 0.85rem;
    }
    
    .nav-icon {
        font-size: 1.1rem;
        margin-right: 0.625rem;
    }
    
    .nav-title {
        font-size: 1rem;
    }
    
    .hamburger-btn {
        width: 1.75rem;
        height: 1.75rem;
    }
}

@media (max-width: 400px) {
    .nav-menu {
        max-width: 100%;
        right: -100%;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
    
    .nav-icon {
        font-size: 1rem;
        margin-right: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .hamburger-nav {
        display: none !important;
    }
}

/* Body adjustment for fixed navigation */
body {
    padding-top: 3.5rem;
}

@media (min-width: 768px) {
    body {
        padding-top: 0;
    }
} 