/* YN Data Frontend Styles */

.yn-data-report-container {
    margin: 20px 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

.yn-data-report-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    max-width: 100%;
}

/* Ensure wrapper doesn't exceed viewport */
@media screen and (max-width: 1400px) {
    .yn-data-report-wrapper {
        overflow-x: scroll;
    }
}

.yn-data-report-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: none;
    font-size: 10px;
    table-layout: auto;
}

.yn-data-report-table thead {
    background: #4a5568;
    color: #ffffff;
    border-bottom: 2px solid #2d3748;
}

.yn-data-report-table thead th {
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 9px;
    border: none;
    white-space: normal;
    line-height: 1.3;
    min-width: 45px;
    max-width: 60px;
    word-wrap: break-word;
    vertical-align: middle;
    height: 65px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Column grouping - add subtle visual separation */
.yn-data-report-table thead th.group-start,
.yn-data-report-table tbody td.group-start,
.yn-data-report-table tfoot td.group-start {
    border-left: 1px solid #d0d0d0;
}

.yn-data-report-table tbody tr {
    border: none;
    border-bottom: 1px solid #f0f0f0;
}

.yn-data-report-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.yn-data-report-table tbody tr:hover {
    background: #f5f5f5;
}

.yn-data-report-table tbody td {
    padding: 4px 6px;
    text-align: center;
    border: none;
    font-size: 10px;
    white-space: nowrap;
}

.yn-data-report-table tbody td.text {
    text-align: left;
    white-space: nowrap;
}

.yn-data-report-table tbody td.date {
    text-align: center;
    white-space: nowrap;
}

.yn-data-report-table tbody td.numeric {
    text-align: center;
}

.yn-data-report-table tbody td .empty-value {
    color: #999;
}

.yn-data-report-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    margin: 20px 0;
}

.yn-data-report-empty {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
    margin: 20px 0;
}

/* Report header */
.yn-data-report-header {
    margin-bottom: 20px;
    text-align: center;
}

.yn-data-report-header .report-title {
    margin: 0 0 20px 0;
    padding: 0;
    font-size: 32px;
    font-weight: normal;
    color: #999;
}

/* Filter Form */
.yn-data-report-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
}

.yn-data-report-filters .filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
    flex-wrap: nowrap;
    align-items: flex-end;
}

.yn-data-report-filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 0 0 auto;
}

.yn-data-report-filters label strong {
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    font-weight: normal;
}

.yn-data-report-filters select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    min-width: 110px;
    max-width: 140px;
}

.yn-data-report-filters input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    width: 110px;
}

.yn-data-report-filters .filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: flex-end;
    margin-left: auto;
}

.yn-data-btn {
    padding: 7px 14px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #3498db;
    color: white;
    white-space: nowrap;
}

.yn-data-btn:hover {
    background: #2980b9;
}

.yn-data-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.yn-data-btn-primary {
    background: #3498db;
    color: white;
}

.yn-data-btn-primary:hover {
    background: #2980b9;
}

.yn-data-btn-secondary {
    background: #3498db;
    color: white;
}

.yn-data-btn-secondary:hover {
    background: #2980b9;
}

/* Record Count */
.record-count {
    margin-bottom: 15px;
    padding: 8px 0;
    font-size: 14px;
    color: #666;
}

.record-count strong {
    color: #333;
    font-weight: 600;
}

/* Report footer */
.yn-data-report-footer {
    margin-top: 15px;
    padding: 10px 0;
    border-top: 1px solid #e5e5e5;
}

.yn-data-report-footer .report-meta {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin: 0;
}

/* Totals row */
.yn-data-report-table tfoot {
    background: #fafafa;
    border-top: 2px solid #e0e0e0;
}

.yn-data-report-table tfoot tr.totals-row {
    background: #fafafa;
    font-weight: bold;
}

.yn-data-report-table tfoot td {
    padding: 6px 4px;
    text-align: center;
    border: none;
    font-size: 10px;
    white-space: nowrap;
}

.yn-data-report-table tfoot td.totals-label {
    text-align: left;
    font-weight: bold;
}

.yn-data-report-table tfoot td.numeric {
    text-align: center;
}

/* Report note */
.report-note {
    margin-top: 10px;
    padding: 5px 0;
    font-size: 13px;
    color: #666;
}

/* Report-specific styling */
.adult-passage-counts .yn-data-report-table {
    margin-top: 10px;
}

/* Adult Passage Count Details Report */
.adult-passage-count-details .yn-data-report-table {
    margin-top: 10px;
}

/* Multi-row header support for Chinook table */
.adult-passage-count-details .chinook-table thead th {
    vertical-align: middle;
    height: auto;
    min-height: 30px;
}

.adult-passage-count-details .chinook-table thead tr:first-child th {
    background: #4a5568;
    color: #ffffff;
}

.adult-passage-count-details .chinook-table thead tr:nth-child(2) th {
    background: #4a5568;
    color: #ffffff;
}

/* Date input fields */
.yn-data-report-filters input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    min-width: 120px;
}

/* Species codes legend */
.species-codes-legend {
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.species-codes-legend p {
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.6;
}

/* Report footnotes */
.report-footnotes {
    margin-bottom: 15px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 3px;
}

.report-footnotes p {
    margin: 5px 0;
    font-size: 13px;
    font-weight: bold;
    color: #856404;
}

/* Responsive table */
@media screen and (max-width: 1200px) {
    .yn-data-report-table {
        font-size: 9px;
    }
    
    .yn-data-report-table thead th {
        font-size: 8px;
        padding: 4px 3px;
    }
    
    .yn-data-report-table tbody td,
    .yn-data-report-table tfoot td {
        padding: 3px 4px;
        font-size: 9px;
    }
}

@media screen and (max-width: 768px) {
    .yn-data-report-table {
        font-size: 8px;
    }
    
    .yn-data-report-table thead th {
        font-size: 7px;
        padding: 3px 2px;
    }
    
    .yn-data-report-table tbody td,
    .yn-data-report-table tfoot td {
        padding: 2px 3px;
        font-size: 8px;
    }
    
    .yn-data-report-header .report-title {
        font-size: 24px;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .filter-row label {
        width: 100%;
    }
    
    .filter-row select,
    .filter-row input[type="text"] {
        width: 100%;
    }
    
    .yn-data-report-filters .filter-buttons {
        margin-left: 0;
        width: 100%;
    }
}

/* ============================================
   Table Component Styles (Modern Design)
   ============================================ */

/* Table Wrapper */
.yn-table-wrapper {
    margin: 20px 0;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    border: none;
    width: 100%;
}

/* Table Controls */
.yn-table-controls {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.yn-table-search {
    flex: 1;
    max-width: 350px;
}

.yn-table-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s;
}

.yn-table-search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* Responsive Table Container */
.yn-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table Base Styles */
.yn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

/* Table Header */
.yn-table thead {
    background: #4a5568;
    border-bottom: 2px solid #2d3748;
}

.yn-table-th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    font-size: 12px;
    text-transform: uppercase;
    white-space: nowrap;
    position: relative;
    user-select: none;
    letter-spacing: 0.3px;
}

/* Sortable Column Headers */
.yn-table-th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.yn-table-th.sortable:hover {
    background-color: #2d3748;
}

.yn-table-th.sortable .sort-icon {
    display: inline-block;
    margin-left: 8px;
    opacity: 0.3;
    font-size: 10px;
}

.yn-table-th.sortable:hover .sort-icon {
    opacity: 0.6;
}

.yn-table-th.sortable.sort-asc .sort-icon .sort-asc,
.yn-table-th.sortable.sort-desc .sort-icon .sort-desc {
    opacity: 1;
    color: #0073aa;
}

.yn-table-th.sortable .sort-icon .sort-asc,
.yn-table-th.sortable .sort-icon .sort-desc {
    display: inline-block;
}

.yn-table-th.sortable.sort-asc .sort-icon .sort-desc,
.yn-table-th.sortable.sort-desc .sort-icon .sort-asc {
    display: none;
}

/* Text Alignment Classes */
.yn-table-th.text-center,
.yn-table-td.text-center {
    text-align: center;
}

.yn-table-th.text-right,
.yn-table-td.text-right {
    text-align: right;
}

.yn-table-th.text-left,
.yn-table-td.text-left {
    text-align: left;
}

/* Table Body */
.yn-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.yn-table-hover tbody tr:hover {
    background-color: #fafafa;
}

.yn-table-striped tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.yn-table-striped tbody tr:nth-child(even):hover {
    background-color: #f5f5f5;
}

.yn-table-td {
    padding: 14px 16px;
    color: #333;
    font-size: 14px;
    vertical-align: middle;
}

/* Bordered Table - Override to remove borders like dataset table */
.yn-table-bordered {
    border: none;
}

.yn-table-bordered .yn-table-th,
.yn-table-bordered .yn-table-td {
    border: none;
}

/* Keep only horizontal borders like dataset table */
.yn-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.yn-table thead {
    border-bottom: 1px solid #e0e0e0;
}

/* Empty State */
.yn-table-empty {
    padding: 40px 16px !important;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Status Badges */
.yn-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
    white-space: nowrap;
}

.yn-status-published {
    background: #d4edda;
    color: #155724;
}

.yn-status-draft {
    background: #fff3cd;
    color: #856404;
}

.yn-status-error {
    background: #f8d7da;
    color: #721c24;
}

.yn-status-default {
    background: #e2e3e5;
    color: #383d41;
}

/* Generic Badge */
.yn-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 12px;
    color: #495057;
}

/* Action Buttons */
.yn-table-actions {
    white-space: nowrap;
}

.yn-table-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 13px;
    color: #0073aa;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    margin-right: 4px;
}

.yn-table-action-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.yn-table-action-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Table Footer */
.yn-table tfoot {
    background: #fafafa;
    border-top: 2px solid #e0e0e0;
}

.yn-table-footer-row .yn-table-td {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Pagination */
.yn-table-pagination {
    padding: 16px;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.yn-pagination-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.yn-pagination-btn:hover:not(:disabled) {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.yn-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.yn-pagination-info {
    font-size: 14px;
    color: #666;
}

.yn-pagination-info .current-page {
    font-weight: 600;
    color: #333;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .yn-table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .yn-table-search {
        max-width: 100%;
    }
    
    .yn-table-th,
    .yn-table-td {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .yn-table-th {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8f9fa;
    }
    
    /* Stack table on mobile if needed */
    .yn-table-responsive.yn-table-mobile-stack .yn-table,
    .yn-table-responsive.yn-table-mobile-stack .yn-table thead,
    .yn-table-responsive.yn-table-mobile-stack .yn-table tbody,
    .yn-table-responsive.yn-table-mobile-stack .yn-table tr,
    .yn-table-responsive.yn-table-mobile-stack .yn-table th,
    .yn-table-responsive.yn-table-mobile-stack .yn-table td {
        display: block;
    }
    
    .yn-table-responsive.yn-table-mobile-stack .yn-table thead {
        display: none;
    }
    
    .yn-table-responsive.yn-table-mobile-stack .yn-table tbody tr {
        margin-bottom: 16px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 8px;
    }
    
    .yn-table-responsive.yn-table-mobile-stack .yn-table-td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    
    .yn-table-responsive.yn-table-mobile-stack .yn-table-td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        font-weight: 600;
        text-align: left;
    }
}
