/* ============================================================================
   POULAILLER.CSS - Styles pour Porte Poulailler Automatique
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

h1 {
    color: #2d3748;
    border-bottom: 4px solid #48bb78;
    padding-bottom: 15px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

/* ============================================================================
   EN-TÊTE AVEC IMAGE
   ============================================================================ */

.header-container {
    margin-bottom: 20px;
}

.header-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 24px 24px 0 0;
    font-size: 2.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    border-bottom: 4px solid #48bb78;
}

.header-title span {
    font-size: 3rem;
}

.header-image {
    position: relative;
    width: 100%;
    height: auto;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.header-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0 0 24px 24px;
}

.version-badge {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255,255,255,0.3);
    z-index: 10;
}

.version-badge span {
    font-size: 1.5rem;
}

@media (max-width: 900px) {
    .header-title {
        font-size: 1.8rem;
        padding: 15px 20px;
    }
    .header-title span {
        font-size: 2.2rem;
    }
    .version-badge {
        bottom: 20px;
        right: 20px;
        padding: 10px 20px;
    }
}

@media (max-width: 600px) {
    .header-title {
        font-size: 1.2rem;
        padding: 12px 15px;
        gap: 8px;
    }
    .header-title span {
        font-size: 1.6rem;
    }
    .version-badge {
        bottom: 15px;
        right: 15px;
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    .version-badge span {
        font-size: 1.1rem;
    }
}

/* ============================================================================
   STATUS BOX
   ============================================================================ */

.status-box {
    font-size: 28px;
    font-weight: bold;
    padding: 20px;
    border-radius: 16px;
    margin: 20px 0;
    text-align: center;
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.open { background: linear-gradient(135deg, #48bb78, #38a169); }
.closed { background: linear-gradient(135deg, #f56565, #e53e3e); }
.moving { background: linear-gradient(135deg, #ed8936, #dd6b20); }
.error { background: linear-gradient(135deg, #9C27B0, #6B21A8); }
.unknown { background: linear-gradient(135deg, #718096, #4a5568); }

/* ============================================================================
   GRILLES
   ============================================================================ */

.grid-3, .grid-2, .grid-4 {
    display: grid;
    gap: 20px;
    margin-bottom: 25px;
}

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================================
   CARTES
   ============================================================================ */

.card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
    color: #2d3748;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a202c;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

/* ============================================================================
   MÉTÉO
   ============================================================================ */

.weather-card {
    border-top: 4px solid #ed8936;
    background: linear-gradient(to bottom, #fffaf0, white);
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.weather-temp {
    font-size: 56px;
    font-weight: 700;
    color: #1a202c;
}

.weather-icon {
    font-size: 56px;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.weather-detail-item {
    text-align: center;
    padding: 12px;
    background: #f7fafc;
    border-radius: 12px;
    color: #2d3748;
}

.weather-detail-item span {
    color: #2d3748;
}

.comfort-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* ============================================================================
   ALERTES
   ============================================================================ */

.alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 12px;
    border-left: 6px solid;
    background: white;
    color: #2d3748;
}

.alert.error { 
    border-left-color: #f56565; 
    background: #fff5f5; 
    color: #742a2a;
}
.alert.warning { 
    border-left-color: #ed8936; 
    background: #fffaf0; 
    color: #744210;
}
.alert.info { 
    border-left-color: #4299e1; 
    background: #ebf8ff; 
    color: #1a4067;
}

.alert strong {
    color: #1a202c;
}

/* ============================================================================
   INFORMATIONS
   ============================================================================ */

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 8px 0;
    background: #f7fafc;
    border-radius: 10px;
    color: #2d3748;
}

.info-row span:first-child {
    color: #4a5568;
}

.info-row span:last-child {
    color: #1a202c;
    font-weight: 600;
}

/* ============================================================================
   BOUTONS DE CONTRÔLE
   ============================================================================ */

.controls {
    display: flex;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
}

button {
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    color: white;
    font-weight: 600;
    transition: all 0.3s;
    flex: 1 1 auto;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-open { background: linear-gradient(135deg, #48bb78, #38a169); }
.btn-close { background: linear-gradient(135deg, #f56565, #e53e3e); }
.btn-save { background: linear-gradient(135deg, #4299e1, #3182ce); }
.btn-backup { background: linear-gradient(135deg, #9C27B0, #6B21A8); }
.btn-refresh { background: linear-gradient(135deg, #718096, #4a5568); }
.btn-watchdog { background: linear-gradient(135deg, #ED64A6, #D53F8C); }
.btn-email { background: linear-gradient(135deg, #667eea, #5a67d8); }
.btn-reset { background: linear-gradient(135deg, #f56565, #c53030); }

.btn-reset:hover {
    background: linear-gradient(135deg, #c53030, #9b2c2c);
}

/* ============================================================================
   CONFIGURATION
   ============================================================================ */

.config-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 16px;
    margin-top: 25px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a202c;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
    color: #2d3748;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #48bb78;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    color: #2d3748;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.button-center {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.button-center button {
    max-width: 300px;
}

/* ============================================================================
   ONGLETS
   ============================================================================ */

.tab {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    background: #edf2f7;
    color: #4a5568;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: none;
}

.tab-btn.active {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================================================
   PIED DE PAGE
   ============================================================================ */

.footer {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.footer-item div {
    color: white;
}

.footer-item div:first-child {
    color: rgba(255, 255, 255, 0.8);
}

.footer-icon {
    width: 45px;
    height: 45px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

/* ============================================================================
   WATCHDOGS
   ============================================================================ */

.watchdog-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.watchdog-table th {
    background: #9C27B0;
    color: white;
    padding: 8px;
    text-align: left;
    border-radius: 8px 8px 0 0;
}

.watchdog-table td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
}

.watchdog-ok { 
    color: #2f6e31; 
    font-weight: 600; 
}

.watchdog-error { 
    color: #9b2c2c; 
    font-weight: 600; 
}

/* ============================================================================
   STATISTIQUES
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 15px 0;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    color: #2d3748;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #48bb78;
}

.success-rate {
    font-size: 48px;
    font-weight: bold;
    color: #48bb78;
}

.progress-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: all 0.3s;
}

.progress-circle:hover {
    transform: scale(1.1);
}

.progress-circle-inner {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #1a202c;
}

.temperature-gauge {
    background: #f7fafc;
    padding: 15px;
    border-radius: 12px;
    margin: 10px 0;
    color: #2d3748;
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.success { 
    background: #48bb78; 
    color: white; 
}

.badge.warning { 
    background: #ed8936; 
    color: white; 
}

.badge.error { 
    background: #f56565; 
    color: white; 
}

/* ============================================================================
   MÉDIAS QUERIES
   ============================================================================ */

@media (max-width: 900px) {
    .grid-3, .grid-4 { 
        grid-template-columns: 1fr; 
    }
    .weather-details { 
        grid-template-columns: repeat(2, 1fr); 
    }
    .stats-grid { 
        grid-template-columns: 1fr; 
    }
}

@media (max-width: 600px) {
    .container { 
        padding: 15px; 
    }
    .controls button { 
        width: 100%; 
    }
    .tab-btn { 
        flex: 1 1 calc(50% - 5px); 
    }
    .status-box {
        font-size: 20px;
        padding: 15px;
    }
    .weather-temp {
        font-size: 40px;
    }
}