/* Importer une police de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@400;700&display=swap');

body {
    font-family: 'SF Pro Display', sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: #333;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background: linear-gradient(135deg, #2c3e50, #000000);
    color: #ffffff;
}

h1 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 20px;
    font-size: 2.5em;
    font-weight: 700;
}

body.dark-mode h1 {
    color: #0a84ff;
}

form {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

body.dark-mode form {
    background: rgba(44, 44, 46, 0.9);
}

form input[type="text"] {
    padding: 12px;
    border: none;
    border-radius: 10px;
    margin: 10px;
    width: 220px;
    background-color: #e6e8ea;
    transition: background-color 0.3s;
}

body.dark-mode form input[type="text"] {
    background-color: #2c2c2e;
    color: #e0e0e0;
}

form input[type="text"]:focus {
    background-color: #e5e5ea;
    outline: none;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    /* Propriété standard pour la compatibilité */
    width: 50%;
    /* Réduire la largeur du slider */
    margin: 10px 0;
    background: transparent;
}

input[type="range"]:focus {
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    /* Réduire la hauteur de la piste */
    cursor: pointer;
    background: #007aff;
    border-radius: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    /* Réduire la taille du pouce */
    width: 20px;
    /* Réduire la taille du pouce */
    border-radius: 50%;
    background: #fff;
    border: 2px solid #007aff;
    cursor: pointer;
    margin-top: -7px;
    /* Ajuster la position du pouce */
    transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #e5e5ea;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    /* Réduire la hauteur de la piste */
    cursor: pointer;
    background: #007aff;
    border-radius: 5px;
}

input[type="range"]::-moz-range-thumb {
    height: 20px;
    /* Réduire la taille du pouce */
    width: 20px;
    /* Réduire la taille du pouce */
    border-radius: 50%;
    background: #fff;
    border: 2px solid #007aff;
    cursor: pointer;
    transition: background 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #e5e5ea;
}

days-label {
    font-weight: bold;
    color: #007aff;
    margin-left: 10px;
}

/* Effet Glassmorphism pour les cases à cocher */
.checkbox-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
    text-align: left;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Effet hover pour les éléments glassmorphism */
.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Mode sombre pour glassmorphism */
body.dark-mode .checkbox-item {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.dark-mode .checkbox-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Style personnalisé pour les checkboxes */
.checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    margin-right: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* État coché de la checkbox */
.checkbox-item input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #007aff, #5ac8fa);
    border-color: #007aff;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

/* Icône de validation */
.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Mode sombre pour les checkboxes */
body.dark-mode .checkbox-item input[type="checkbox"] {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .checkbox-item input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #0a84ff, #64d2ff);
    border-color: #0a84ff;
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.4);
}

/* Labels avec effet glassmorphism */
.checkbox-item label {
    cursor: pointer;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    user-select: none;
    flex: 1;
    transition: color 0.3s ease;
}

body.dark-mode .checkbox-item label {
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Effet de brillance au survol */
.checkbox-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.checkbox-item:hover::before {
    left: 100%;
}

/* Animation d'activation de la checkbox */
.checkbox-item input[type="checkbox"]:checked {
    animation: checkboxPulse 0.3s ease;
}

@keyframes checkboxPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

form button {
    padding: 12px 24px;
    background-color: #007aff;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s;
    margin-top: 10px;
    font-weight: 700;
}

form button:hover {
    background-color: #005ecb;
    transform: translateY(-2px);
}

#commune-selection {
    text-align: center;
    margin-bottom: 20px;
}

#commune-selection button {
    padding: 10px 20px;
    margin: 5px;
    background-color: #007aff;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s;
    font-weight: 700;
}

#commune-selection button:hover {
    background-color: #005ecb;
    transform: translateY(-2px);
}

body.dark-mode #commune-selection button {
    background-color: #0a84ff;
    color: #121212;
}

body.dark-mode #commune-selection button:hover {
    background-color: #0066cc;
}

.main-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .weather-card-content {
        flex-direction: column;
        text-align: center;
    }

    .weather-icon-section {
        flex: none;
        width: auto;
        max-width: 200px;
        margin: 0 auto 15px auto;
        padding: 10px 15px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .weather-status {
        font-size: 0.9em;
        word-wrap: break-word;
        text-align: center;
        width: 100%;
    }

    .weather-details {
        text-align: center;
        width: 100%;
    }

    .temp-section {
        justify-content: center;
        gap: 20px;
    }

    .weather-info-item {
        flex-direction: row;
        text-align: left;
        justify-content: space-between;
        gap: 10px;
    }

    .weather-info-item span:last-child {
        text-align: right;
    }

    #map {
        height: 300px;
    }

    /* Responsive pour mobile - glassmorphism */
    .checkbox-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .checkbox-item {
        padding: 12px 16px;
    }
    
    .checkbox-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }
    
    .checkbox-item label {
        font-size: 0.9em;
    }
}

#weather-container {
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

body.dark-mode #weather-container {
    background: rgba(44, 44, 46, 0.9);
}

#map-container {
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

body.dark-mode #map-container {
    background: rgba(44, 44, 46, 0.9);
}

#map {
    height: 350px;
    width: 100%;
    border-radius: 10px;
}

/* Styles pour les cartes météo */
.weather-card {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    border: 3px solid #1d4ed8;
    border-radius: 15px;
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    position: relative;
}

body.dark-mode .weather-card {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border-color: #1e3a8a;
}

.weather-card-header {
    background-color: #1d4ed8;
    color: white;
    padding: 10px 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

body.dark-mode .weather-card-header {
    background-color: #1e3a8a;
}

.weather-card-content {
    display: flex;
    padding: 20px;
    align-items: flex-start;
    gap: 20px;
}

.weather-icon-section {
    flex: 0 0 120px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
}

.weather-icon {
    font-size: 3em;
    margin-bottom: 8px;
    display: block;
}

.weather-status {
    color: white;
    font-weight: bold;
    font-size: 1em;
    line-height: 1.2;
}

.weather-details {
    flex: 1;
    color: white;
    min-width: 0;
}

.temp-section {
    display: flex;
    gap: 25px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.temp-min,
.temp-max {
    font-size: 1.2em;
    font-weight: bold;
    white-space: nowrap;
}

.weather-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 0.9em;
}

.weather-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    line-height: 1.3;
}

.weather-info-item span:first-child {
    font-weight: 500;
    margin-right: 10px;
}

.weather-info-item span:last-child {
    font-weight: bold;
    text-align: right;
}

.optional-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.optional-info .weather-info-grid {
    grid-template-columns: 1fr;
    gap: 6px;
}

#toggle-dark-mode {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px;
    background-color: #007aff;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s;
    z-index: 1000;
    font-weight: 700;
}

#toggle-dark-mode:hover {
    background-color: #005ecb;
    transform: translateY(-2px);
}

body.dark-mode #toggle-dark-mode {
    background-color: #0a84ff;
    color: #121212;
}

body.dark-mode #toggle-dark-mode:hover {
    background-color: #0066cc;
}

.map-title {
    text-align: center;
    margin-bottom: 15px;
    color: #007aff;
    font-size: 1.2em;
    font-weight: bold;
}

body.dark-mode .map-title {
    color: #0a84ff;
}

.new-search-btn {
    display: block;
    margin: 20px auto 0;
    padding: 12px 24px;
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s;
}

.new-search-btn:hover {
    background-color: #005ecb;
    transform: translateY(-2px);
}

body.dark-mode .new-search-btn {
    background-color: #0a84ff;
    color: #121212;
}

body.dark-mode .new-search-btn:hover {
    background-color: #0066cc;
}

/* Dégradés pour différents types de météo */
.sunny-gradient {
    background: linear-gradient(135deg, #f9d423, #ff4e50);
    /* Ensoleillé */
}

.cloudy-gradient {
    background: linear-gradient(135deg, #bdc3c7, #2c3e50);
    /* Nuageux */
}

.rainy-gradient {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    /* Pluvieux */
}

body.dark-mode .sunny-gradient {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    /* Ensoleillé (sombre) */
}

body.dark-mode .cloudy-gradient {
    background: linear-gradient(135deg, #95a5a6, #34495e);
    /* Nuageux (sombre) */
}

body.dark-mode .rainy-gradient {
    background: linear-gradient(135deg, #3498db, #2980b9);
    /* Pluvieux (sombre) */
}
