/**
 * Sierra at Tahoe - Table Block Styles
 * Enhanced styling for core/table block to match Figma status tables
 */

/* =============================================================================
   Base Table Styling
   ============================================================================= */

.wp-block-table {
    margin: var(--wp--preset--spacing--large) 0;
    font-family: var(--wp--preset--font-family--gt-standard);
    font-size: var(--wp--preset--font-size--small);
    line-height: var(--wp--preset--line-height--relaxed);
    border-collapse: collapse;
    width: 100%;
    background-color: var(--wp--preset--color--snowcap-sage);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-family: inherit;
}

/* =============================================================================
   Table Headers
   ============================================================================= */

.wp-block-table th {
    background-color: var(--wp--preset--color--sugar-pine-green);
    color: var(--wp--preset--color--snowcap-sage);
    font-family: var(--wp--preset--font-family--mont);
    font-size: var(--wp--preset--font-size--small);
    font-weight: var(--wp--preset--font-weight--heavy);
    text-align: left;
    padding: var(--wp--preset--spacing--medium) var(--wp--preset--spacing--large);
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-block-table th:first-child {
    border-top-left-radius: 8px;
}

.wp-block-table th:last-child {
    border-top-right-radius: 8px;
}

/* =============================================================================
   Table Cells
   ============================================================================= */

.wp-block-table td {
    padding: var(--wp--preset--spacing--medium) var(--wp--preset--spacing--large);
    border: none;
    border-bottom: 1px solid rgba(10, 106, 88, 0.1);
    vertical-align: middle;
    font-family: var(--wp--preset--font-family--gt-standard);
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--deep-alpine);
    line-height: var(--wp--preset--line-height--relaxed);
}

/* Alternating row colors */
.wp-block-table tbody tr:nth-child(even) {
    background-color: rgba(245, 255, 240, 0.5);
}

.wp-block-table tbody tr:nth-child(odd) {
    background-color: var(--wp--preset--color--snowcap-sage);
}

.wp-block-table tbody tr:hover {
    background-color: rgba(10, 106, 88, 0.05);
    transition: background-color 0.2s ease;
}

/* Remove border from last row */
.wp-block-table tbody tr:last-child td {
    border-bottom: none;
}

/* =============================================================================
   Status Indicators and Special Content
   ============================================================================= */

/* Status text styling */
.sierra-status-open,
.sierra-status-yes,
.sierra-status-closed,
.sierra-status-no {
    font-weight: var(--wp--preset--font-weight--heavy);
    text-transform: uppercase;
    font-size: var(--wp--preset--font-size--caption);
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.sierra-status-open,
.sierra-status-yes {
    color: var(--wp--preset--color--sugar-pine-green);
    background-color: rgba(10, 106, 88, 0.1);
}

.sierra-status-closed,
.sierra-status-no {
    color: #D32F2F;
    background-color: rgba(211, 47, 47, 0.1);
}

/* Trail indicator circles */
.sierra-trail-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--wp--preset--color--sugar-pine-green);
    display: inline-block;
    margin-right: var(--wp--preset--spacing--small);
    vertical-align: middle;
    flex-shrink: 0;
}

/* Difficulty level indicators */
.sierra-trail-indicator.difficulty-beginner {
    background-color: #4CAF50; /* Green circle */
}

.sierra-trail-indicator.difficulty-intermediate {
    background-color: #2196F3; /* Blue square indicator */
    border-radius: 2px;
}

.sierra-trail-indicator.difficulty-advanced {
    background-color: #000;
    transform: rotate(45deg); /* Diamond shape */
}

.sierra-trail-indicator.difficulty-expert {
    background-color: #000;
    border-radius: 0;
    transform: rotate(45deg);
    border: 2px solid #000;
    background-color: transparent;
}

/* Trail name with indicator */
.sierra-trail-name {
    display: flex;
    align-items: center;
    gap: var(--wp--preset--spacing--small);
}

/* Number styling for counts */
.sierra-count {
    font-weight: var(--wp--preset--font-weight--medium);
    color: var(--wp--preset--color--deep-alpine);
    font-family: var(--wp--preset--font-family--mont);
}

/* =============================================================================
   Table Variations for Different Status Types
   ============================================================================= */

/* Lifts Table */
.wp-block-table.sierra-lifts-table th:first-child {
    width: 40%;
}

.wp-block-table.sierra-lifts-table th:nth-child(2) {
    width: 30%;
    text-align: center;
}

.wp-block-table.sierra-lifts-table th:last-child {
    width: 30%;
    text-align: center;
}

.wp-block-table.sierra-lifts-table td:nth-child(2),
.wp-block-table.sierra-lifts-table td:last-child {
    text-align: center;
}

/* Trails Table */
.wp-block-table.sierra-trails-table th:first-child {
    width: 35%;
}

.wp-block-table.sierra-trails-table th:nth-child(2) {
    width: 20%;
    text-align: center;
}

.wp-block-table.sierra-trails-table th:nth-child(3) {
    width: 20%;
    text-align: center;
}

.wp-block-table.sierra-trails-table th:last-child {
    width: 25%;
    text-align: center;
}

.wp-block-table.sierra-trails-table td:nth-child(2),
.wp-block-table.sierra-trails-table td:nth-child(3),
.wp-block-table.sierra-trails-table td:last-child {
    text-align: center;
}

/* Roads Table */
.wp-block-table.sierra-roads-table th:first-child {
    width: 25%;
}

.wp-block-table.sierra-roads-table th:nth-child(2) {
    width: 20%;
    text-align: center;
}

.wp-block-table.sierra-roads-table th:last-child {
    width: 55%;
}

.wp-block-table.sierra-roads-table td:nth-child(2) {
    text-align: center;
}

.wp-block-table.sierra-roads-table td:last-child {
    font-size: var(--wp--preset--font-size--caption);
    color: rgba(20, 44, 45, 0.8);
    line-height: 1.4;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

/* Tablet Layout */
@media (max-width: 768px) {
    .wp-block-table th,
    .wp-block-table td {
        padding: var(--wp--preset--spacing--small) var(--wp--preset--spacing--medium);
        font-size: var(--wp--preset--font-size--caption);
    }

    .wp-block-table th {
        font-size: 11px;
    }

    /* Stack comments on mobile for roads table */
    .wp-block-table.sierra-roads-table td:last-child {
        font-size: 11px;
        line-height: 1.3;
    }
}

/* Mobile Layout */
@media (max-width: 480px) {
    .wp-block-table {
        font-size: var(--wp--preset--font-size--caption);
        margin: var(--wp--preset--spacing--medium) 0;
    }

    .wp-block-table th,
    .wp-block-table td {
        padding: var(--wp--preset--spacing--tiny) var(--wp--preset--spacing--small);
    }

    .wp-block-table th {
        font-size: 10px;
        letter-spacing: 0.3px;
    }

    /* Status indicators smaller on mobile */
    .sierra-status-open,
    .sierra-status-yes,
    .sierra-status-closed,
    .sierra-status-no {
        font-size: 10px;
        padding: 2px 6px;
        min-width: 50px;
    }

    /* Smaller trail indicators */
    .sierra-trail-indicator {
        width: 8px;
        height: 8px;
        margin-right: 6px;
    }

    /* Hide comments column on very small screens for roads table */
    .wp-block-table.sierra-roads-table td:last-child,
    .wp-block-table.sierra-roads-table th:last-child {
        display: none;
    }
}

/* =============================================================================
   Accessibility Enhancements
   ============================================================================= */

/* High contrast mode */
@media (prefers-contrast: high) {
    .wp-block-table {
        border: 2px solid var(--wp--preset--color--deep-alpine);
    }

    .wp-block-table th {
        border-bottom: 2px solid var(--wp--preset--color--snowcap-sage);
    }

    .wp-block-table td {
        border-bottom: 1px solid var(--wp--preset--color--deep-alpine);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wp-block-table tbody tr {
        transition: none;
    }
}

/* Focus indicators */
.wp-block-table:focus {
    outline: 3px solid var(--wp--preset--color--sierra-gold);
    outline-offset: 2px;
}

/* Screen reader improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    .wp-block-table {
        break-inside: avoid;
        page-break-inside: avoid;
        background: white !important;
        box-shadow: none;
        border: 1px solid #000;
    }

    .wp-block-table th {
        background: #f0f0f0 !important;
        color: #000 !important;
    }

    .wp-block-table tbody tr:nth-child(even) {
        background: #f9f9f9 !important;
    }

    .wp-block-table tbody tr:nth-child(odd) {
        background: white !important;
    }

    .sierra-trail-indicator {
        border: 1px solid #000;
    }
}