/* TheAVCoach Weather Station for WeatherLink Widget Styles */

/* Reset and base styles */
* {
    box-sizing: border-box;
}

/* Table wrapper - prevents horizontal scrolling */
.weatherlink-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
}

/* Main table - allow natural expansion */
.weatherlink-table {
    display: table !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

/* Force table to expand beyond wrapper if needed */
.weatherlink-table-wrapper {
    overflow: visible !important;
    max-width: none !important;
    width: auto !important;
    position: relative !important;
}

/* CRITICAL: Override any parent container constraints */
.weatherlink-table-wrapper,
.weatherlink-table-wrapper *,
.weatherlink-table,
.weatherlink-table * {
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

/* Force table to break out of any width constraints */
.weatherlink-table {
    position: relative !important;
    z-index: 1 !important;
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    overflow: visible !important;
}

/* Ensure cells can expand infinitely */
.weatherlink-table th,
.weatherlink-table td {
    position: relative !important;
    z-index: 2 !important;
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    overflow: visible !important;
}

/* OVERRIDE ANY POSSIBLE PARENT CONSTRAINTS */
body .weatherlink-table-wrapper,
body .weatherlink-table,
body .weatherlink-table *,
div .weatherlink-table-wrapper,
div .weatherlink-table,
div .weatherlink-table *,
p .weatherlink-table-wrapper,
p .weatherlink-table,
p .weatherlink-table *,
.entry-content .weatherlink-table-wrapper,
.entry-content .weatherlink-table,
.entry-content .weatherlink-table *,
.post-content .weatherlink-table-wrapper,
.post-content .weatherlink-table,
.post-content .weatherlink-table *,
.widget .weatherlink-table-wrapper,
.widget .weatherlink-table,
.widget .weatherlink-table * {
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

/* Table headers and cells - ensure text is never cut off */
.weatherlink-table th,
.weatherlink-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 8px 6px !important;
    text-align: center !important;
    vertical-align: middle !important;
    overflow: visible !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-overflow: clip !important;
    box-sizing: border-box !important;
}

/* Ensure all content is visible */
.weatherlink-table th *,
.weatherlink-table td *,
.weatherlink-table .weather-value,
.weatherlink-table .weather-header-primary,
.weatherlink-table .weather-header-secondary {
    overflow: visible !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
}

/* Error message styling */
.weatherstation-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.4;
}

.weatherstation-error a {
    color: #721c24;
    text-decoration: underline;
}

.weatherstation-error a:hover {
    color: #491217;
}

/* Widget styling */
.weatherlink-widget-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.weatherlink-widget-item span {
    color: inherit !important;
}

.weatherlink-widget-item i {
    color: inherit !important;
}

.weatherlink-primary {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.weatherlink-secondary {
    font-size: 1em;
    color: #555;
    margin-bottom: 0.25em;
}

.weatherlink-cell {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.weatherlink-icon {
    width: 1.5em;
    text-align: center;
}

.weatherlink-widget-item:last-child {
    border-bottom: none;
}

/* Desktop styles */
@media (min-width: 769px) {
    .weatherlink-table .header-row {
        display: table-row !important;
    }
    
    .weatherlink-table th {
        font-weight: bold !important;
        border: 1px solid #ddd !important;
    }
}

/* Medium screen styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .weatherlink-table th,
    .weatherlink-table td {
        padding: 8px 4px !important;
        font-size: 14px !important;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .weatherlink-table {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }
    
    .weatherlink-table tbody {
        display: block !important;
    }
    
    .weatherlink-table tr {
        display: block !important;
        margin-bottom: 20px !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        background-color: #fff !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    .weatherlink-table thead,
    .weatherlink-table .header-row,
    .weatherlink-table th {
        display: none !important;
    }
    
    .weatherlink-table td {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 15px 10px !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        background-color: #fff !important;
        font-size: 18px !important;
        color: #333 !important;
        position: relative !important;
    }
    
    .weatherlink-table td:last-child {
        border-bottom: none !important;
    }
    
    .weatherlink-table td:before {
        content: attr(data-label) !important;
        display: block !important;
        font-weight: bold !important;
        font-size: 14px !important;
        color: #333 !important;
        margin-bottom: 8px !important;
        background-color: #f8f9fa !important;
        padding: 8px !important;
        border-radius: 4px !important;
        border-bottom: 1px solid #ddd !important;
    }
    
    .weatherlink-table .empty-cell {
        display: none !important;
    }
    
    .weatherlink-table .weather-value {
        color: #000000 !important;
        font-weight: 500 !important;
        font-size: 18px !important;
    }
    
    .weatherlink-table .weather-value-primary,
    .weatherlink-table .weather-value-secondary {
        font-size: 18px !important;
    }
    
    .weatherlink-primary, .weatherlink-secondary {
        font-size: 1.1em;
    }
    
    .weatherlink-cell {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .weatherlink-table tr {
        margin-bottom: 15px !important;
    }
    
    .weatherlink-table td {
        padding: 12px 8px !important;
        font-size: 16px !important;
    }
    
    .weatherlink-table td:before {
        font-size: 13px !important;
        padding: 6px !important;
        margin-bottom: 6px !important;
    }
    
    .weatherlink-primary, .weatherlink-secondary {
        font-size: 1em;
    }
    
    .weatherlink-cell {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25em;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .weatherlink-widget-item {
        border-bottom-color: #333;
    }
    
    @media (max-width: 768px) {
        .weatherlink-table tr {
            background-color: #2d3748 !important;
            border-color: #4a5568 !important;
        }
        
        .weatherlink-table td {
            background-color: #2d3748 !important;
            color: #f7fafc !important;
            border-bottom-color: #4a5568 !important;
        }
        
        .weatherlink-table td:before {
            background-color: #4a5568 !important;
            color: #e2e8f0 !important;
            border-bottom-color: #2d3748 !important;
        }
    }
}

/* Timestamp styling */
.weatherlink-table .timestamp,
.weatherlink-table .widget-timestamp,
.weather-widget .timestamp,
.weather-widget .widget-timestamp {
    font-size: 0.9em !important;
    text-align: left !important;
    margin-top: 15px !important;
    padding: 8px !important;
    border-top: 1px solid #eee !important;
    font-style: italic !important;
}

/* Mock data timestamp styling */
.weatherlink-table .mock-timestamp,
.weatherlink-table .widget-timestamp.mock-timestamp,
.weather-widget .mock-timestamp,
.weather-widget .widget-timestamp.mock-timestamp {
    background: #ff8c42 !important;
    border: 1px solid #e67e22 !important;
    color: #ffffff !important;
    border-radius: 4px !important;
    font-weight: bold !important;
}

/* General widget timestamp */
.weather-widget .widget-timestamp {
    margin-top: 10px !important;
    font-size: 0.85em !important;
}

/* Dark theme timestamp */
@media (prefers-color-scheme: dark) {
    .weatherlink-table .timestamp,
    .weatherlink-table .widget-timestamp,
    .weather-widget .timestamp,
    .weather-widget .widget-timestamp {
        border-top-color: #333 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .weatherlink-widget-item {
        border-bottom-color: #000;
    }
    
    .weatherlink-widget-item i {
        color: #000;
    }
} 