/* PEP 2025 Complete Table Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
}

/* Return Button Styling */
.return-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    border: none;
    cursor: pointer;
}

.return-button:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.return-button:active {
    transform: translateY(0);
}

/* Top return button container */
.top-return {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 2000;
}

/* Bottom return button container */
.bottom-return {
    text-align: center;
    padding: 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Top orange/yellow bar */
.top-bar {
    background: linear-gradient(to bottom, #FFA500, #FFD700);
    color: black;
    padding: 8px 20px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1000;
    padding-right: 180px; /* Make room for return button */
}

.top-bar .left {
    font-weight: bold;
}

.top-bar .right {
    font-size: 12px;
}

/* Black welcome bar */
.welcome-bar {
    background-color: #000000;
    color: white;
    padding: 8px 20px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 999;
}

/* Main container */
.container {
    margin: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Green page title section */
.page-title-section {
    background-color: #4CAF50;
    color: white;
    padding: 20px 30px;
    font-size: 24px;
    font-weight: bold;
    position: relative;
    z-index: 998;
}

/* Table info bar */
.table-info {
    background-color: #e3f2fd;
    padding: 12px 20px;
    border-bottom: 1px solid #bbdefb;
    font-size: 12px;
    color: #1565c0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 997;
}

.sort-info {
    font-weight: bold;
    color: #0d47a1;
}

/* Table container with BOTH horizontal and vertical scroll + sticky headers */
.table-container {
    position: relative;
    overflow: auto;
    max-height: 70vh;
    border: 1px solid #ddd;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Custom scrollbar styling for WebKit browsers */
.table-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.table-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* Table styling */
table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: auto;
    position: relative;
}

/* FROZEN/STICKY COLUMN HEADERS */
thead {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #2196F3;
}

/* Sortable column headers */
th {
    background-color: #2196F3;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    font-size: 14px;
    border-right: 1px solid #1976D2;
    border-bottom: 2px solid #1976D2;
    white-space: nowrap;
    min-width: 80px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
    position: sticky;
    top: 0;
    z-index: 101;
}

th:hover {
    background-color: #1976D2;
}

th:last-child {
    border-right: none;
}

/* Sort indicators */
.sort-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    opacity: 0.7;
}

.sort-asc::after {
    content: " ▲";
    color: #ffeb3b;
}

.sort-desc::after {
    content: " ▼";
    color: #ffeb3b;
}

.sort-none::after {
    content: " ↕";
    opacity: 0.5;
}

/* Table rows */
td {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    font-size: 14px;
    vertical-align: top;
    line-height: 1.4;
    min-width: 80px;
    white-space: normal;
    word-wrap: break-word;
    background-color: inherit;
}

td:last-child {
    border-right: none;
}

/* Alternating row colors */
tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:nth-child(odd) {
    background-color: white;
}

tbody tr:hover {
    background-color: #e3f2fd !important;
}

/* Data type specific styling */
td.number {
    text-align: right;
    white-space: nowrap;
    min-width: 60px;
    max-width: 120px;
}

td.short-text {
    min-width: 100px;
    max-width: 200px;
}

td.long-text {
    min-width: 150px;
    max-width: 300px;
}

/* Error styling */
.error {
    background: #ffebee;
    padding: 15px 30px;
    color: #c62828;
    border-left: 4px solid #f44336;
    margin: 20px;
}

/* No data message */
.no-data {
    padding: 30px;
    text-align: center;
    color: #666;
    font-size: 16px;
}

/* Scroll hint */
.scroll-hint {
    text-align: center;
    padding: 10px;
    background-color: #fff3e0;
    color: #e65100;
    font-size: 12px;
    border-top: 1px solid #ffcc02;
}

/* Sort reset button */
.sort-reset {
    background-color: #ff9800;
    color: white;
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.sort-reset:hover {
    background-color: #f57c00;
}

/* Sticky header indicator */
.sticky-indicator {
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ffeb3b, #ff9800, #ffeb3b);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.table-container.scrolled .sticky-indicator {
    opacity: 1;
}

/* Image Footer */
.image-footer {
    background-color: #2c3e50;
    padding: 30px 20px;
    text-align: center;
    margin-top: 20px;
}

.footer-image {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.image-footer-caption {
    color: white;
    margin-top: 15px;
    font-size: 14px;
    font-weight: bold;
}

.image-footer-subtitle {
    color: #bdc3c7;
    margin-top: 5px;
    font-size: 12px;
}

/* Placeholder for missing image */
.footer-image-placeholder {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 40px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .top-return {
        position: static;
        text-align: center;
        padding: 10px;
        background-color: rgba(255,255,255,0.9);
    }
    
    .top-bar {
        padding-right: 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .container { 
        margin: 10px; 
        border-radius: 0;
    }
    
    .welcome-bar {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .page-title-section { 
        padding: 15px 20px; 
        font-size: 18px;
    }
    
    table { 
        font-size: 12px; 
    }
    
    th, td { 
        padding: 8px 10px;
        min-width: 60px;
    }
    
    .table-info {
        font-size: 11px;
        padding: 8px 15px;
    }
    
    .table-container {
        max-height: 60vh;
    }
    
    .return-button {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .image-footer {
        padding: 20px 10px;
    }
    
    .footer-image {
        max-height: 150px;
    }
}

/* Print styles */
@media print {
    .top-return, .bottom-return, .welcome-bar, .table-info, .scroll-hint, .top-bar {
        display: none;
    }
    
    .container {
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }
    
    .table-container {
        overflow: visible;
        max-height: none;
        border: none;
    }
    
    table {
        page-break-inside: auto;
        font-size: 10px;
        width: 100% !important;
    }
    
    th, td {
        padding: 6px 8px;
    }
    
    thead {
        position: static;
    }
    
    th {
        position: static;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .image-footer {
        background-color: transparent !important;
        border-top: 2px solid #000;
        page-break-inside: avoid;
    }
    
    .image-footer-caption,
    .image-footer-subtitle {
        color: black !important;
    }
}


/* Image Footer - White Background Version */
.image-footer {
    background-color: #ffffff;
    padding: 30px 20px;
    text-align: center;
    margin-top: 20px;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.footer-image {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.image-footer-caption {
    color: #2c3e50;
    margin-top: 15px;
    font-size: 16px;
    font-weight: bold;
}

.image-footer-subtitle {
    color: #6c757d;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.6;
}

/* Footer Links for White Background */
.footer-link {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.footer-main-link {
    color: #dc3545;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-main-link:hover {
    color: #c82333;
    text-decoration: underline;
}

/* Placeholder for missing image */
.footer-image-placeholder {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 40px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}