/* Weather Widget Styles - Using original app styles */
:root {
    /* Světlý režim - základní paleta barev */
    --primary-color: #4099ff;
    --primary-light: #6db9ff;
    --primary-dark: #2874a6;
    --secondary-color: #2980b9;
    --accent-color: #f1c40f;
    --danger-color: #ff6b6b;
    --success-color: #38d39f;
    --warning-color: #ffa502;
    
    /* Světlý režim - neutrální barvy */
    --light-color: #f8f9fa;
    --dark-color: #2c3e50;
    --gray-color: #8c9db5;
    --light-gray-color: #eef2f7;
    --card-bg-color: #ffffff;
    --body-bg-color: #f8f9fc;
    --text-color: #2c3e50;
    --text-secondary: #6c757d;
    --border-color: rgba(0, 0, 0, 0.07);
    
    /* Světlý režim - záhlaví */
    --header-bg-color: rgba(255, 255, 255, 0.97);
    --header-text-color: #2c3e50;
    
    /* Světlý režim - karty a součásti UI */
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 4px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.06);
    --weather-card-gradient: linear-gradient(135deg, #4099ff, #3366ff);
    --weather-card-text: #ffffff;
    
    /* Efekty */
    --transition-speed: 0s;
    
    /* Zaoblení */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
}

/* Tmavý režim - přepíše proměnné z světlého režimu */
[data-theme="dark"] {
    /* Tmavý režim - základní paleta barev */
    --primary-color: #64b1ff;
    --primary-light: #83c6ff;
    --primary-dark: #3e80c9;
    --secondary-color: #4b99db;
    --accent-color: #ffd028;
    --danger-color: #ff7676;
    --success-color: #5de8b5;
    --warning-color: #ffa726;
    
    /* Tmavý režim - neutrální barvy */
    --light-color: #343a40;
    --dark-color: #f8f9fa;
    --gray-color: #a0aec0;
    --light-gray-color: #2c3544;
    --card-bg-color: #1e2a3a;
    --body-bg-color: #141e2c;
    --text-color: #e9ecef;
    --text-secondary: #a0aec0;
    --border-color: rgba(255, 255, 255, 0.07);
    
    /* Tmavý režim - záhlaví */
    --header-bg-color: rgba(30, 42, 58, 0.97);
    --header-text-color: #e9ecef;
    
    /* Tmavý režim - karty a součásti UI */
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.15);
    --weather-card-gradient: linear-gradient(135deg, #285a9c, #1a3c6b);
    --weather-card-text: #ffffff;
}

.weather-widget {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--body-bg-color);
    color: var(--text-color);
}

/* Dashboard card styles from original app - jen pro widget */
.weather-widget .dashboard-card {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
}

/* Tenké orámování karet ve světlém režimu - jen pro widget */
:root .weather-widget .dashboard-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .weather-widget .dashboard-card {
    border: none;
}

.weather-widget .current-weather-card {
    background: var(--weather-card-gradient);
    color: var(--weather-card-text);
    border: none;
}

/* Widget weather card - lepší kontrast */
.widget-weather-card {
    background: var(--card-bg-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .widget-weather-card {
    background: var(--card-bg-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* Widget text colors - jen pro widget */
.weather-widget .widget-temp {
    color: var(--text-color) !important;
}

.weather-widget .widget-text {
    color: var(--text-secondary) !important;
}

/* Bílé pozadí pro aktuální počasí ve světlém režimu - jen pro widget */
:root .weather-widget .current-weather-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Zachovat gradient v tmavém režimu - jen pro widget */
[data-theme="dark"] .weather-widget .current-weather-card {
    background: var(--weather-card-gradient);
    color: var(--weather-card-text);
    border: none;
}

.weather-widget .current-weather-icon i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.9);
}

.weather-widget .current-info-container h2 {
    font-size: 2.5rem;
    color: white;
}

.weather-widget .current-info-container p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.25rem;
}

/* Ensure current temp is white on blue background - maximální specificita */
div.weather-widget .card.current-weather-card #current-temp,
div.weather-widget .card.current-weather-card h2#current-temp,
div.weather-widget .current-weather-card .current-info-container #current-temp,
div.weather-widget .current-weather-card .temperature {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* Override for both light and dark themes - maximální specificita */
html:root div.weather-widget .card.current-weather-card #current-temp,
html:root div.weather-widget .card.current-weather-card h2#current-temp,
html:root div.weather-widget .current-weather-card .current-info-container #current-temp,
html[data-theme="dark"] div.weather-widget .card.current-weather-card #current-temp,
html[data-theme="dark"] div.weather-widget .card.current-weather-card h2#current-temp,
html[data-theme="dark"] div.weather-widget .current-weather-card .current-info-container #current-temp {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* Loading state - jen pro widget */
.weather-widget .widget-loading {
    height: 200px;
    background: transparent;
}

/* Error state - jen pro widget */
.weather-widget .widget-error {
    min-height: 150px;
}

/* Header - jen pro widget */
.weather-widget .widget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-widget .widget-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.weather-widget .widget-model {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Body - jen pro widget */
.weather-widget .widget-body {
    padding: 20px;
}

.weather-widget .current-weather {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weather-icon-container {
    flex-shrink: 0;
}

.weather-icon {
    width: 64px;
    height: 64px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.weather-main {
    flex: 1;
    text-align: center;
}

.temperature {
    font-size: 2.5rem;
    font-weight: 300;
    color: #333;
    line-height: 1;
    margin-bottom: 4px;
}

.temp-value {
    font-weight: 600;
}

.temp-unit {
    font-size: 1.5rem;
    color: #666;
}

.weather-description {
    font-size: 0.95rem;
    color: #666;
    text-transform: capitalize;
}

.weather-details {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 100px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #666;
}

.detail-item i {
    width: 16px;
    font-size: 14px;
    color: #888;
}

/* Footer */
.widget-footer {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.last-update {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

/* Bootstrap ikony - přizpůsobení barev - jen pro widget */
:root .weather-widget .bi {
    color: #6c757d;
}

[data-theme="dark"] .weather-widget .bi {
    color: #a0aec0;
}

.weather-widget .detail-item .bi {
    color: var(--primary-color) !important;
}

/* Weather icons protection - jen pro widget */
.weather-widget .weather-icon {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* Text colors with theme support - jen pro widget (kromě current-temp na modré kartě) */
.weather-widget .temperature:not(#current-temp) {
    color: var(--text-color);
}

/* DŮLEŽITÉ: Zajistit, že hlavní index zůstane nezměněn */
/* Resetovat jakékoliv ovlivnění #current-temp mimo widget kontejner */
html:not(.weather-widget) #current-temp,
body:not(.weather-widget) #current-temp,
#current-temp:not(.weather-widget #current-temp) {
    color: unset !important;
    text-shadow: unset !important;
}

.weather-widget .weather-description,
.weather-widget .detail-item {
    color: var(--text-secondary);
}

.weather-widget .widget-footer {
    background: var(--light-color);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.weather-widget .temp-unit {
    color: var(--text-secondary);
}

/* Weather icons - jen pro widget */
.weather-widget .weather-icon.sunny {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23FFA726"><circle cx="12" cy="12" r="4"/><path d="M12 2l1.09 2.09L15 3l-1.09 1.09L12 6L10.91 4.09L9 3l2.09-1.09L12 2zM21 12l-2.09-1.09L20 9l-1.09 2.09L17 12l2.09 1.09L20 15l1.09-2.09L21 12zM12 18l1.09 2.09L15 21l-1.09-1.09L12 18l-1.09 1.09L9 21l2.09-1.09L12 18zM5 12l-2.09-1.09L4 9l-1.09 2.09L1 12l2.09 1.09L4 15l1.09-2.09L5 12z"/></svg>');
}

.weather-widget .weather-icon.cloudy {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2366BB6A"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2s-.9-2-2-2H8c-1.1 0-2 .9-2 2zM12 2C9.24 2 7 4.24 7 7c0 2.76 2.24 5 5 5s5-2.24 5-5c0-2.76-2.24-5-5-5zm-1 16h2v2h-2v-2zm-1-4h4v2h-4v-2z"/></svg>');
}

.weather-widget .weather-icon.rainy {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2342A5F5"><path d="M6 14c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm4 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6-12C9.24 2 7 4.24 7 7c0 2.76 2.24 5 5 5s5-2.24 5-5c0-2.76-2.24-5-5-5z"/></svg>');
}

.weather-widget .weather-icon.snowy {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23E1F5FE"><path d="M12 2l3.09 6.26L22 9l-5.91 5.74L17.18 22 12 19.27 6.82 22l1.09-7.26L2 9l6.91-.74L12 2z"/></svg>');
}

/* Responsive design */
@media (max-width: 480px) {
    .weather-widget {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .weather-widget .current-weather {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .weather-widget .weather-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        width: 100%;
    }
    
    .weather-widget .temperature {
        font-size: 2rem;
    }
}

/* Error state - jen pro widget */
.weather-widget .widget-error .alert {
    border-radius: 0;
}

/* Animation - jen pro widget */
.weather-widget .widget-content {
    /* animation: fadeIn 0.3s ease-in; - removed initial animation */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner customization - jen pro widget */
.weather-widget .widget-loading .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Hodinová předpověď - styly jen pro widget kontejnery */
.weather-widget .today-hourly-preview {
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Prevent scrollbars */
    padding-right: 10px; /* Add margin on right */
    box-sizing: border-box;
}

.weather-widget .hourly-preview-wrapper {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 5px;
    padding: 10px 5px; /* Small horizontal padding */
    box-sizing: border-box;
    justify-content: center;
    align-content: start;
    overflow: visible; /* Allow content to be visible */
}

.weather-widget .hourly-preview-item {
    /* Critical layout properties from main index */
    width: 55px !important;
    flex: 0 0 55px !important;
    box-sizing: border-box !important;
    
    /* Display properties */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: center !important;
    
    /* Spacing and appearance */
    border-radius: 8px !important;
    padding: 6px 4px !important;
    min-height: 80px !important;
    transition: background-color 0.2s ease, transform 0.2s ease;
    
    /* Tmavý režim - bílé pozadí s průhledností */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

.weather-widget .hourly-preview-item *,
.weather-widget .hourly-preview-item .preview-time,
.weather-widget .hourly-preview-item .preview-temp,
.weather-widget .hourly-preview-item .small {
    color: #ffffff !important;
}

.weather-widget .hourly-preview-item:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
}

/* Světlý režim - tmavé pozadí s průhledností */
:root .weather-widget .hourly-preview-item {
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.4) !important;
    color: #2c3e50 !important;
}

:root .weather-widget .hourly-preview-item *,
:root .weather-widget .hourly-preview-item .preview-time,
:root .weather-widget .hourly-preview-item .preview-temp,
:root .weather-widget .hourly-preview-item .small {
    color: #2c3e50 !important;
}

:root .weather-widget .hourly-preview-item:hover {
    background-color: rgba(255, 255, 255, 0.6) !important;
}

/* Specifické barvy pro srážky zůstávají modré */
.weather-widget .hourly-preview-item .small[style*="color: #0ea5e9"],
.weather-widget .hourly-preview-item [style*="color: #0ea5e9"] {
    color: #0ea5e9 !important;
}

.weather-widget .preview-time {
    font-weight: 500;
    margin-bottom: 3px;
    font-size: 0.7rem;
}

.weather-widget .preview-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2px;
}

.weather-widget .preview-temp {
    font-size: 0.85rem;
    margin-bottom: 2px;
    font-weight: bold;
}

.weather-widget .preview-rain {
    font-size: 0.7rem;
    margin: 2px 0;
    color: #0066cc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 1rem;
}

.weather-widget .preview-rain i {
    font-size: 0.6rem;
    color: #0066cc;
}

.weather-widget .preview-wind {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responzivní styly pro malé obrazovky - jen pro widget */
@media (max-width: 600px) {
    .weather-widget .hourly-preview-item {
        padding: 4px 2px !important;
        min-height: 70px !important;
    }
    
    .weather-widget .preview-time {
        font-size: 0.65rem;
    }
    
    .weather-widget .preview-temp {
        font-size: 0.8rem;
    }
}

@media (max-width: 400px) {
    .weather-widget .hourly-preview-item {
        padding: 3px 1px !important;
        min-height: 65px !important;
    }
    
    .weather-widget .preview-time {
        font-size: 0.6rem;
    }
    
    .weather-widget .preview-temp {
        font-size: 0.75rem;
    }
}

/* ULTIMATE Force zobrazení - override main style.css hiding rules - jen pro widget */
.weather-widget .hourly-preview-wrapper {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.weather-widget .hourly-preview-item {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Override style.css media query hiding rules - jen pro widget */
.weather-widget #today-hourly-preview {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Specifically override style.css hiding rules for different ranges - jen pro widget */
.weather-widget .current-weather-grid .hourly-preview-wrapper,
.weather-widget .current-weather-grid #today-hourly-preview {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Override any potential hiding media queries - jen pro widget */
@media screen {
    .weather-widget .hourly-preview-wrapper {
        display: grid !important;
        width: 100% !important;
    }
    
    .weather-widget .hourly-preview-item {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* Explicit overrides for style.css hiding media queries - jen pro widget */
@media (min-width: 768px) and (max-width: 991px) {
    .weather-widget #today-hourly-preview,
    .weather-widget .hourly-preview-wrapper {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    .weather-widget .hourly-preview-wrapper {
        display: grid !important;
    }
    .weather-widget .hourly-preview-item {
        display: flex !important;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .weather-widget #today-hourly-preview,
    .weather-widget .hourly-preview-wrapper {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    .weather-widget .hourly-preview-wrapper {
        display: grid !important;
    }
    .weather-widget .hourly-preview-item {
        display: flex !important;
    }
}

@media (max-width: 575px) {
    .weather-widget #today-hourly-preview,
    .weather-widget .hourly-preview-wrapper {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    .weather-widget .hourly-preview-wrapper {
        display: grid !important;
    }
    .weather-widget .hourly-preview-item {
        display: flex !important;
    }
}

@media (max-width: 1200px) {
    .weather-widget .hourly-preview-wrapper {
        display: grid !important;
    }
    .weather-widget .hourly-preview-item {
        display: flex !important;
    }
}