html {
  height: 100%;
}

body {
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #1e3a8a;
  background-color: #f8fafc;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Layout containers - reduce default spacing */
.playhq-container {
  margin: 0;
  padding: 10px;
}

.playhq-header {
  margin: 0 0 10px 0;
  padding: 0;
}

.playhq-main-content {
  margin: 0;
  padding: 0;
}

/* Timestamp styling */
.playhq-timestamp {
  margin: 0 0 15px 0;
  padding: 0;
  font-size: 14px;
  color: #666;
  text-align: center;
}

/* Cricket Club Report Styling */

.report-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.report-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #0066cc;
}

.report-title {
    color: #0066cc;
    margin-bottom: 10px;
}

.report-meta {
    color: #666;
    font-size: 14px;
}

.section-title {
    color: #0066cc;
    margin: 30px 0 15px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #0066cc;
}

.playhq-fixtures-warning {
    color: #dc2626;
    font-size: 14px;
    font-weight: 600;
    margin: -10px 0 20px 0;
    padding: 8px 12px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    text-align: center;
}

.playhq-warning-link {
    color: #dc2626;
    text-decoration: underline;
    font-weight: 700;
    transition: all 0.2s ease;
}

.playhq-warning-link:hover {
    color: #991b1b;
    text-decoration: none;
    background-color: rgba(220, 38, 38, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Shared table styles */
.playhq-results-table,
.playhq-fixtures-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 14px;
}

.playhq-results-table thead,
.playhq-fixtures-table thead {
    background: linear-gradient(135deg, #0066cc, #004499);
    color: white;
}

.playhq-results-table th,
.playhq-fixtures-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #004499;
    vertical-align: top; /* Ensure headers are also top-aligned */
}

/* SHARED TABLE COLUMN WIDTHS - Both tables now have 7 columns with consistent first 6 */
.playhq-results-table th:nth-child(1),
.playhq-fixtures-table th:nth-child(1) { /* Grade */
    width: 16%;
}

.playhq-results-table th:nth-child(2),
.playhq-fixtures-table th:nth-child(2) { /* Round */
    width: 8%;
}

.playhq-results-table th:nth-child(3),
.playhq-fixtures-table th:nth-child(3) { /* Home Team */
    width: 22%;
}

.playhq-results-table th:nth-child(4),
.playhq-fixtures-table th:nth-child(4) { /* Away Team */
    width: 22%;
}

.playhq-results-table th:nth-child(5),
.playhq-fixtures-table th:nth-child(5) { /* Date & Time */
    width: 14% !important;
    white-space: nowrap;
}

.playhq-results-table th:nth-child(6),
.playhq-fixtures-table th:nth-child(6) { /* Venue */
    width: 12%;
}

.playhq-results-table th:nth-child(7) { /* Club Result (emoji only) */
    width: 6%;
    text-align: center;
}

.playhq-fixtures-table th:nth-child(7) { /* Status */
    width: 6%;
    text-align: center;
}

.playhq-results-table td,
.playhq-fixtures-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #ddd;
    vertical-align: top; /* Ensure all cells are top-aligned */
}

/* Comprehensive top alignment override for all table cells */
.playhq-results-table td,
.playhq-results-table th,
.playhq-fixtures-table td,
.playhq-fixtures-table th {
    vertical-align: top !important; /* Force top alignment for consistency */
}

/* Shared table data cell styling for consistent columns */
.playhq-results-table td:nth-child(5),
.playhq-fixtures-table td:nth-child(5) { /* Date & Time */
    white-space: nowrap;
    width: 14% !important;
    vertical-align: top; /* Ensure consistent top alignment */
}

.playhq-results-table td:nth-child(7) { /* Club Result (emoji only) */
    text-align: center;
    width: 6%;
    vertical-align: top; /* Ensure top alignment even with center text */
}

.playhq-fixtures-table td:nth-child(7) { /* Status */
    text-align: center;
    width: 6%;
    vertical-align: top; /* Ensure top alignment even with center text */
}

/* Status and result styling */
.result-emoji {
    font-size: 16px;
    text-align: center;
}

.playhq-status-upcoming {
    color: #2563eb;
    font-weight: 500;
}

.playhq-status-in-progress {
    color: #dc2626;
    font-weight: 500;
}

.playhq-status-completed {
    color: #16a34a;
    font-weight: 500;
}

.playhq-status-no-matches {
    color: #6b7280;
    font-weight: 400;
}

.playhq-results-table tbody tr:nth-child(even),
.playhq-fixtures-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.playhq-results-table tbody tr:nth-child(odd),
.playhq-fixtures-table tbody tr:nth-child(odd) {
    background-color: white;
}

.playhq-results-table tbody tr:hover,
.playhq-fixtures-table tbody tr:hover {
    background-color: #e3f2fd;
}

.playhq-clickable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.playhq-clickable-row:hover {
    background-color: #bbdefb !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.playhq-team-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

/* Team cell layout with logo alignment */
.playhq-team-cell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 60px; /* Increased to accommodate larger logos */
}

.playhq-team-logo-container {
    display: flex;
    align-items: flex-start; /* Changed from center to flex-start for top alignment */
    justify-content: center;
    min-height: 60px; /* Updated to match team cell min-height */
    flex-shrink: 0; /* Prevent container from shrinking */
    padding-top: 2px; /* Small offset to align with text baseline */
}

.playhq-team-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Changed from center to flex-start for top alignment */
    flex-grow: 1;
    min-height: 40px; /* Match team cell min-height */
}

.playhq-team-name {
    font-weight: 500;
    line-height: 1.3;
}

.playhq-team-score {
    font-size: 16px;
    color: #6b7280;
    font-weight: bold;
    margin-top: 10px;
    line-height: 1.3;
}

.playhq-winner-score {
    color: #059669 !important;
    font-weight: 600 !important;
}

.result-emoji {
    font-size: 18px;
    text-align: center;
}

.playhq-match-link {
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
}

.playhq-match-link:hover {
    text-decoration: underline;
}

.playhq-status-upcoming {
    color: #28a745;
    font-weight: bold;
}

.playhq-status-completed {
    color: #6c757d;
}

.playhq-status-in-progress {
    color: #ffc107;
    font-weight: bold;
}

.no-data {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Desktop-specific rules to ensure proper column widths */
@media (min-width: 769px) {
    .playhq-results-table th:nth-child(5),
    .playhq-fixtures-table th:nth-child(5),
    .playhq-results-table td:nth-child(5),
    .playhq-fixtures-table td:nth-child(5) {
        width: 14% !important;
        min-width: 100px !important;
    }
}

@media (max-width: 768px) {
    /* Mobile Card Layout */
    .playhq-results-table,
    .playhq-fixtures-table {
        border: none;
        box-shadow: none;
    }
    
    /* Hide table headers on mobile */
    .playhq-results-table thead,
    .playhq-fixtures-table thead {
        display: none;
    }
    
    /* Transform table structure for cards */
    .playhq-results-table tbody,
    .playhq-fixtures-table tbody {
        display: block;
    }
    
    .playhq-results-table tr,
    .playhq-fixtures-table tr {
        display: block;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        position: relative;
    }
    
    .playhq-results-table tr:hover,
    .playhq-fixtures-table tr:hover {
        transform: none;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    /* Reset table cell display for mobile cards */
    .playhq-results-table td,
    .playhq-fixtures-table td {
        display: block;
        border: none;
        padding: 4px 0;
        text-align: left !important;
        width: auto !important;
        white-space: normal !important;
    }
    
    /* Hide empty or N/A cells to clean up mobile view */
    .playhq-results-table td:empty,
    .playhq-fixtures-table td:empty,
    .playhq-results-table td:contains("N/A"),
    .playhq-fixtures-table td:contains("N/A") {
        display: none;
    }
    
    /* Card header with grade/round info */
    .playhq-results-table td:nth-child(1),
    .playhq-fixtures-table td:nth-child(1) {
        font-size: 18px;
        font-weight: bold;
        color: #0066cc;
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px solid #e2e8f0;
    }
    
    /* Round info - smaller and less prominent */
    .playhq-results-table td:nth-child(2),
    .playhq-fixtures-table td:nth-child(2) {
        font-size: 14px;
        color: #6b7280;
        margin-bottom: 8px;
    }
    
    /* Teams section */
    .playhq-results-table td:nth-child(3),
    .playhq-results-table td:nth-child(4),
    .playhq-fixtures-table td:nth-child(3),
    .playhq-fixtures-table td:nth-child(4) {
        margin: 8px 0;
    }
    
    /* Make team logos slightly larger on mobile */
    .playhq-team-logo {
        width: 56px;
        height: 56px;
    }
    
    /* Date/time styling for cards - use full width with inline calendar icon */
    .playhq-results-table td:nth-child(5),
    .playhq-fixtures-table td:nth-child(5) {
        font-weight: 600;
        color: #374151;
        margin: 8px 0;
        width: 100% !important;
        white-space: normal !important;
        display: flex !important;
        align-items: center;
        gap: 4px;
        font-size: 15px;
    }
    
    /* Venue styling */
    .playhq-results-table td:nth-child(6),
    .playhq-fixtures-table td:nth-child(6) {
        color: #6b7280;
        font-size: 14px;
    }
    
    /* Status/Result positioning */
    .playhq-results-table td:nth-child(7),
    .playhq-fixtures-table td:nth-child(7) {
        position: absolute;
        top: 16px;
        right: 16px;
        margin: 0;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px; /* Reduced font size */
        max-width: 70px; /* Limit width to force truncation */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        background-color: rgba(0, 0, 0, 0.05); /* Light background for better visibility */
    }
    
    /* Add labels for better mobile readability */
    .playhq-results-table td:nth-child(2):before { content: "Round: "; font-weight: bold; color: #6b7280; }
    .playhq-results-table td:nth-child(5):before { content: "📅 "; }
    .playhq-results-table td:nth-child(6):before { content: "📍 "; }
    
    .playhq-fixtures-table td:nth-child(2):before { content: "Round: "; font-weight: bold; color: #6b7280; }
    .playhq-fixtures-table td:nth-child(5):before { content: "📅 "; }
    .playhq-fixtures-table td:nth-child(6):before { content: "📍 "; }
    
    /* Responsive container adjustments */
    .report-container {
        padding: 16px;
        margin: 8px;
    }
    
    .playhq-fixtures-warning {
        margin: -5px 0 16px 0;
        padding: 12px;
        font-size: 13px;
    }
}
