/**
 * KS - Météo Circuits
 * Styles pour l'affichage de la météo
 * Compatible avec le thème karting-sud.com
 */

/* Container principal */
.ks-meteo-container {
    max-width: 100%;
    margin: 15px 0;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
}

/* Header */
.ks-meteo-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ffffff;
    padding: 10px 15px;
    text-align: center;
}

.ks-meteo-titre {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff !important;
}

/* Styles pour location supprimés car non utilisés */

.ks-meteo-city {
    font-weight: bold;
}

/* Conteneur des jours */
.ks-meteo-days {
    padding: 0;
}

/* Jour individuel */
.ks-meteo-day {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.3s ease;
}

.ks-meteo-day:last-child {
    border-bottom: none;
}

.ks-meteo-day:hover {
    background-color: #f8f9fa;
}

/* Header du jour */
.ks-meteo-day-header {
    display: grid;
    grid-template-columns: 1fr auto auto 40px;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    position: relative;
    min-height: 50px;
}

.ks-meteo-day-date {
    font-size: 15px;
    font-weight: bold;
    color: #2c3e50;
}

.ks-meteo-day-summary {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ks-meteo-icon {
    width: 35px;
    height: 35px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    background: rgba(52, 152, 219, 0.2);
    border-radius: 50%;
    padding: 2px;
}

.ks-meteo-icon-wrapper {
    display: inline-block;
    position: relative;
}

.ks-meteo-icon-wrapper img {
    display: block;
}

.ks-meteo-temps {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ks-meteo-temp-max {
    font-size: 16px;
    font-weight: bold;
    color: #e74c3c;
}

.ks-meteo-temp-min {
    font-size: 14px;
    color: #3498db;
}

.ks-meteo-day-description {
    font-size: 13px;
    color: #7f8c8d;
    text-transform: capitalize;
}

/* Bouton toggle */
.ks-meteo-toggle {
    background: none;
    border: 2px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #3498db;
    font-size: 14px;
}

.ks-meteo-toggle:hover {
    background-color: #3498db;
    color: white;
    transform: scale(1.1);
}

.ks-meteo-day.open .ks-meteo-toggle {
    background-color: #3498db;
    color: white;
}

.ks-meteo-toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.ks-meteo-day.open .ks-meteo-toggle-icon {
    transform: rotate(180deg);
}

/* Détails du jour (accordéon) */
.ks-meteo-day-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding 0.3s ease;
    background-color: #f8f9fa;
    padding: 0 20px;
}

.ks-meteo-day.open .ks-meteo-day-details {
    max-height: 5000px;
    padding: 20px;
    border-top: 2px solid #e0e0e0;
}

/* Prévisions horaires */
.ks-meteo-hourly {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.ks-meteo-hour {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.ks-meteo-hour:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
    border-color: #3498db;
}

.ks-meteo-hour-time {
    font-size: 15px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
}

.ks-meteo-hour-icon {
    width: 40px;
    height: 40px;
    margin: 8px auto;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    background: rgba(52, 152, 219, 0.2);
    border-radius: 50%;
    padding: 2px;
}

.ks-meteo-hour-temp {
    font-size: 20px;
    font-weight: bold;
    color: #e74c3c;
    margin: 8px 0;
}

.ks-meteo-hour-desc {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 8px;
    text-transform: capitalize;
    min-height: 32px;
}

/* Informations détaillées */
.ks-meteo-hour-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    text-align: left;
}

.ks-meteo-info-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
}

.ks-meteo-info-label {
    color: #7f8c8d;
    font-weight: 500;
}

.ks-meteo-info-value {
    color: #2c3e50;
    font-weight: bold;
}

/* Footer */
.ks-meteo-footer {
    background-color: #ecf0f1;
    padding: 10px 15px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.ks-meteo-footer-content {
    margin: 0;
    font-size: 11px;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ks-meteo-credits,
.ks-meteo-plugin-credit,
.ks-meteo-integration {
    display: inline;
}

.ks-meteo-separator {
    color: #bdc3c7;
    margin: 0 4px;
}

.ks-meteo-popup-link {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.ks-meteo-popup-link:hover {
    text-decoration: underline;
    color: #2980b9;
}

.ks-meteo-credits a,
.ks-meteo-plugin-credit a {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
}

.ks-meteo-credits a:hover,
.ks-meteo-plugin-credit a:hover {
    text-decoration: underline;
}

/* Messages d'erreur */
.ks-meteo-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    color: #721c24;
    padding: 15px;
    margin: 20px 0;
    font-weight: 500;
}

/* Popup météo pour intégration */
.ks-meteo-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ks-meteo-popup-container {
    background: #ffffff;
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.ks-meteo-popup-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ks-meteo-popup-header h3 {
    margin: 0;
    font-size: 22px;
    color: #ffffff;
}

.ks-meteo-popup-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 36px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 36px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.ks-meteo-popup-close:hover {
    opacity: 0.7;
}

.ks-meteo-popup-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px;
}

.ks-meteo-popup-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #7f8c8d;
}

/* Adapter le widget météo dans le popup */
.ks-meteo-popup-body .ks-meteo-container {
    margin: 0;
    box-shadow: none;
    border: none;
}

/* Mobile popup */
@media screen and (max-width: 768px) {
    .ks-meteo-popup-container {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .ks-meteo-popup-header {
        padding: 15px;
    }
    
    .ks-meteo-popup-header h3 {
        font-size: 18px;
    }
    
    .ks-meteo-popup-body {
        padding: 15px;
    }
}

@media screen and (max-width: 480px) {
    .ks-meteo-popup-overlay {
        padding: 10px;
    }
    
    .ks-meteo-popup-container {
        border-radius: 8px;
    }
    
    .ks-meteo-popup-header {
        padding: 12px;
    }
    
    .ks-meteo-popup-header h3 {
        font-size: 16px;
    }
    
    .ks-meteo-popup-body {
        padding: 10px;
    }
}

/* Modal pour intégration */
.ks-meteo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ks-meteo-modal {
    background: #ffffff;
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ks-meteo-modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.ks-meteo-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #ffffff;
}

.ks-meteo-modal-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
}

.ks-meteo-modal-close:hover {
    opacity: 0.7;
}

.ks-meteo-modal-body {
    padding: 20px;
}

.ks-meteo-modal-body h4 {
    color: #2c3e50;
    margin: 20px 0 10px 0;
    font-size: 16px;
}

.ks-meteo-modal-body h4:first-child {
    margin-top: 0;
}

.ks-meteo-modal-body p {
    color: #7f8c8d;
    font-size: 14px;
    margin: 5px 0 10px 0;
}

.ks-meteo-code-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 12px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.ks-meteo-code-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #2c3e50;
    word-break: break-all;
}

.ks-meteo-copy-btn {
    background: #3498db;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    transition: background 0.3s ease;
}

.ks-meteo-copy-btn:hover {
    background: #2980b9;
}

.ks-meteo-copy-btn:active {
    transform: scale(0.95);
}

/* Mobile modal */
@media screen and (max-width: 768px) {
    .ks-meteo-modal {
        max-width: 100%;
        max-height: 90vh;
    }
    
    .ks-meteo-code-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ks-meteo-copy-btn {
        width: 100%;
    }
    
    .ks-meteo-footer-content {
        font-size: 10px;
        gap: 6px;
    }
    
    .ks-meteo-separator {
        margin: 0 2px;
    }
}

@media screen and (max-width: 480px) {
    .ks-meteo-footer-content {
        flex-direction: column;
        gap: 4px;
    }
    
    .ks-meteo-separator {
        display: none;
    }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .ks-meteo-day-header {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
        padding: 8px 10px;
        min-height: 45px;
    }
    
    .ks-meteo-day-summary {
        justify-content: center;
    }
    
    .ks-meteo-toggle {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 24px;
        height: 24px;
        font-size: 12px;
        border-width: 1.5px;
    }
    
    /* Icônes optimisées pour mobile */
    .ks-meteo-icon {
        width: 32px;
        height: 32px;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
        background: rgba(52, 152, 219, 0.2);
    }
    
    .ks-meteo-icon-wrapper {
        font-size: 32px !important;
        line-height: 32px !important;
    }
    
    .ks-meteo-hour-icon {
        width: 36px;
        height: 36px;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
        background: rgba(52, 152, 219, 0.2);
    }
    
    .ks-meteo-hourly {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 10px;
    }
    
    .ks-meteo-titre {
        font-size: 16px;
        color: #ffffff !important;
    }
    
    .ks-meteo-day-date {
        font-size: 14px;
    }
    
    .ks-meteo-header {
        padding: 10px;
    }
    
    /* Températures lisibles sur mobile */
    .ks-meteo-temp-max {
        font-size: 15px;
    }
    
    .ks-meteo-temp-min {
        font-size: 13px;
    }
    
    /* Détails horaires optimisés */
    .ks-meteo-hour-temp {
        font-size: 18px;
    }
    
    .ks-meteo-info-item {
        font-size: 11px;
        padding: 3px 0;
    }
}

@media screen and (max-width: 480px) {
    .ks-meteo-hourly {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .ks-meteo-hour {
        padding: 10px;
    }
    
    .ks-meteo-container {
        border-radius: 5px;
        margin: 10px 0;
    }
    
    .ks-meteo-header {
        padding: 8px;
    }
    
    .ks-meteo-day-header {
        padding: 6px 8px;
        min-height: 42px;
    }
    
    .ks-meteo-titre {
        font-size: 15px;
        color: #ffffff !important;
    }
    
    .ks-meteo-day-date {
        font-size: 13px;
    }
    
    /* Icônes encore plus visibles sur petits écrans */
    .ks-meteo-icon {
        width: 30px;
        height: 30px;
        background: rgba(52, 152, 219, 0.25);
    }
    
    .ks-meteo-icon-wrapper {
        font-size: 30px !important;
        line-height: 30px !important;
    }
    
    .ks-meteo-hour-icon {
        width: 34px;
        height: 34px;
        background: rgba(52, 152, 219, 0.25);
    }
    
    /* Toggle très accessible */
    .ks-meteo-toggle {
        width: 28px;
        height: 28px;
        font-size: 14px;
        top: 8px;
        right: 8px;
    }
    
    /* Footer compact */
    .ks-meteo-footer {
        padding: 8px 10px;
    }
    
    .ks-meteo-credits {
        font-size: 10px;
    }
}

/* Animation d'apparition */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ks-meteo-day-details {
    animation: fadeIn 0.5s ease-out;
}

/* Style pour l'impression */
@media print {
    .ks-meteo-toggle {
        display: none;
    }
    
    .ks-meteo-day-details {
        max-height: none !important;
        overflow: visible !important;
        padding: 20px !important;
    }
    
    .ks-meteo-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}
