/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Heebo', 'Arial', sans-serif;
    background: #fff;
    min-height: 100vh;
    display: block;
    padding: 0;
}

/* Stage plein écran pour la mise à l'échelle 16/9 */
.stage {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
    padding: 0;
    position: relative;
}

/* Conteneur principal avec ratio 16:9 adaptatif */
.teouda-container {
    /* Calculer la taille optimale en gardant le ratio 16:9 avec marge de 5px */
    width: min(calc(100vw - 10px), calc(90vh * 16 / 9), 1920px);
    height: min(90vh, calc((100vw - 10px) * 9 / 16), 1080px);
    
    background: url('image/teouda-fond.jpg') center/cover no-repeat #ffffff;
    border-radius: min(0.625vmin, 12px);
    box-shadow: 0 min(1vmin, 20px) min(3vmin, 60px) rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    font-size: min(1vmin, 16px);
}

/* Nouvelle grille */
.grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1.2fr 1fr;
    gap: min(1vw, 20px);
    padding: min(1.25vw, 24px);
    padding-top: min(6.5vw, 74px);
    padding-left: min(6.5vw, 124px);
    padding-right: min(6.5vw, 124px);
}

.panel {
    background: transparent;
    backdrop-filter: none;
    border-radius: 0;
    border: 0;
    padding: min(0.8vw, 16px) min(0.9vw, 18px);
}

.tl-panel { grid-column: 1 / 2; grid-row: 1 / 2; }
.tm-panel { grid-column: 2 / 3; grid-row: 1 / 2; display:flex; flex-direction: column; align-items:center; justify-content:flex-start; }
.tr-panel { grid-column: 3 / 4; grid-row: 1 / 2; }
.tr-panel { justify-self: end; align-self: start; text-align: right; margin-top: min(2.6vw, 50px); }
.validity-banner {
    margin-top: min(14.5vw, 300px);
    font-size: min(1.5vw, 28px);
    font-weight: 700;
    color: #d4af37;
    text-align: center;
    background: rgba(255,255,255,0.0);
    white-space: nowrap;
}

.attention-banner {
    margin-top: min(0.75vw, 15px);
    margin-left: min(0.26vw, 5px);
    margin-right: min(0.26vw, 5px);
    padding: min(0.8vw, 9px) min(2.5vw, 50px);
    background: #d3484f;
    color: white;
    font-size: 0.9vw;
    font-weight: 700;
    text-align: center;
    border-radius: min(0.5vw, 10px);
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: min(0.05vw, 1px);
    width: calc(min(45vw, 864px) - 10px);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

/* Bloc établissement x2 */
.tr-panel h4 { font-size: min(1.9vw, 36px); }
.tr-panel .establishment-name { font-size: min(2.5vw, 48px); color: #d4af37; }
.tr-panel .establishment-address { font-size: min(1.7vw, 32px); line-height: 1.35; }
.tr-panel .establishment-phone { font-size: min(1.5vw, 28px); }
.ml-panel { grid-column: 1 / 2; grid-row: 2 / 3; }
.mc-panel { grid-column: 2 / 3; grid-row: 2 / 3; padding-left: min(1.5vw, 30px); padding-right: min(1.5vw, 30px); }
.mr-panel { grid-column: 3 / 4; grid-row: 2 / 3; }

/* Décalage vertical des blocs du milieu */
.ml-panel, .mc-panel, .mr-panel { margin-top: min(-1.3vw, -25px); }

/* En-têtes panel */
.panel h4 {
    font-size: min(0.9vw, 18px);
    color: #1e3c72;
    margin-bottom: min(0.6vw, 12px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: min(0.05vw, 1px);
}

/* +50% tailles pour Horaires, Fêtes, Informations */
.ml-panel h4, .mc-panel h4, .mr-panel h4 { font-size: min(1.4vw, 27px); }

/* Horaires du Shabbat */
.ml-panel .shabbat-row .label { font-size: min(1.1vw, 21px); }
.ml-panel .shabbat-row .value { font-size: min(1.4vw, 27px); }
.ml-panel .shabbat-date { font-size: min(1.2vw, 23px); font-weight: 700; }

/* Prochaines fêtes */
.mc-panel .holiday-item { padding: min(0.45vw, 9px); }
.mc-panel .holiday-name { font-size: min(1.4vw, 26px); }
.mc-panel .holiday-date { font-size: min(1.2vw, 22px); }

/* Informations générales */
.mr-panel .cert-row .label { font-size: min(1.1vw, 21px); }
.mr-panel .cert-row .value { font-size: min(1vw, 19px); }
/* Compacter légèrement le bloc Informations générales */
.mr-panel .cert-info { gap: min(0.5vw, 10px); }
.mr-panel .cert-row { padding: min(0.4vw, 8px) 0; }
.mr-panel .cert-row .value { line-height: 1.25; }

/* Suppression des fonds/encadrements des anciens blocs si présents */
.shabbat-times,
.upcoming-holidays,
.qr-section,
.establishment-info,
.certification-details,
.validation-status {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Bloc dates/statut/QR */
.dates .date-fr { font-size: min(2.1vw, 41px); font-weight: 600; color: #1e3c72; }
.dates .date-he { font-size: min(1.9vw, 36px); color: #2a5298; margin-top: min(0.1vw, 2px); }
.dates .time { font-size: min(3.1vw, 59px); font-weight: 700; color: #d4af37; margin-top: min(0.3vw, 6px); }

.status-verify { display: flex; align-items: flex-start; gap: min(0.8vw, 16px); margin-top: min(0.5vw, 10px); }
.status-box { display:flex; flex-direction: column; align-items:center; }
.status-verify .qr-code.small, .status-verify .status-box { margin-top: 0; }

/* Bloc statut carré, design similaire au QR */
.status-box .status-placeholder { width: min(6.25vw, 120px); height: min(6.25vw, 120px); background: #1e3c72; border-radius: min(0.4vw, 8px); display:flex; align-items:center; justify-content:center; }
.status-box .status-inner { width: min(5.2vw, 100px); height: min(5.2vw, 100px); background: #fff; border-radius: min(0.2vw, 4px); display:flex; align-items:center; justify-content:center; }
.status-box .status-symbol { font-size: min(3.3vw, 64px); font-weight: 800; line-height: 1; }
.status-valid .status-symbol { color: #198754; }
.status-expired .status-symbol { color: #198754; }

.qr-code.small .qr-placeholder { width: min(6.25vw, 120px); height: min(6.25vw, 120px); background: #1e3c72; border-radius: min(0.4vw, 8px); display:flex; align-items:center; justify-content:center; }
.qr-code.small .qr-grid { width: min(5.2vw, 100px); height: min(5.2vw, 100px); background: #fff; border-radius: min(0.2vw, 4px); position: relative; }
.qr-code.small .qr-image { width: min(5.2vw, 100px); height: min(5.2vw, 100px); object-fit: contain; border-radius: min(0.2vw, 4px); background: #fff; }
.qr-code.small .qr-text { font-size: min(0.6vw, 12px); color: #666; margin-top: min(0.3vw, 6px); }

/* En-tête */
.teouda-header {
    background: linear-gradient(90deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #d4af37;
}

.header-left .logo-consistoire {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-placeholder {
    font-size: 40px;
    color: #d4af37;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

.current-datetime {
    text-align: right;
}

.current-date {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 5px;
}

.current-time {
    font-size: 26px;
    font-weight: 700;
    color: #d4af37;
}

/* Titre principal */
.main-title {
    text-align: center;
    padding: 16px 0;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-bottom: 2px solid #d4af37;
}

.main-title h2 {
    font-size: 36px;
    color: #1e3c72;
    margin-bottom: 10px;
    font-weight: 700;
    direction: rtl;
}

.main-title h3 {
    font-size: 22px;
    color: #2a5298;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Contenu principal */
/* Ancienne structure supprimée (remplacée par .grid) */

/* Colonne gauche */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.establishment-info,
.certification-details,
.validation-status {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border-left: 6px solid #d4af37;
}

.establishment-info h4,
.certification-details h4 {
    font-size: 16px;
    color: #1e3c72;
    margin-bottom: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.establishment-name {
    font-size: 24px;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 15px;
}

.establishment-address {
    font-size: 16px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 10px;
}

.establishment-phone {
    font-size: 14px;
    color: #2a5298;
    font-weight: 500;
}

.cert-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cert-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.cert-row:last-child {
    border-bottom: none;
}

.cert-row .label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.cert-row .value {
    font-size: 14px;
    color: #1e3c72;
    font-weight: 600;
}

/* Statut de validation */
.validation-status {
    background: linear-gradient(45deg, #28a745, #20c997) !important;
    border-left: 6px solid #155724 !important;
    color: white;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-icon {
    background: white;
    color: #28a745;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
}

.status-text {
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Colonne droite */
/* supplanté par .grid */

.shabbat-times,
.upcoming-holidays,
.qr-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border-left: 6px solid #d4af37;
}

.shabbat-times h4,
.upcoming-holidays h4,
.qr-section h4 {
    font-size: 16px;
    color: #1e3c72;
    margin-bottom: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shabbat-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.shabbat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.shabbat-row:last-of-type {
    border-bottom: none;
}

.shabbat-row .label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.shabbat-row .value {
    font-size: 18px;
    color: #1e3c72;
    font-weight: 700;
}

.shabbat-date {
    text-align: center;
    font-size: 12px;
    color: #1e3c72;
    font-style: normal;
    margin-top: min(0.5vw, 10px);
    padding-top: min(0.5vw, 10px);
    border-top: 1px solid #e9ecef;
}

/* Fêtes à venir */
.holidays-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.holiday-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #d4af37;
}

.holiday-name {
    font-size: 14px;
    font-weight: 600;
    color: #d4af37;
}

.holiday-date {
    font-size: 12px;
    color: #666;
    font-weight: 700;
}

/* QR Code */
.qr-section {
    text-align: center;
}

.qr-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.qr-placeholder {
    width: 120px;
    height: 120px;
    background: #1e3c72;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-grid {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 4px;
    position: relative;
}

.qr-pattern::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: repeating-linear-gradient(
        0deg,
        #1e3c72 0px,
        #1e3c72 2px,
        white 2px,
        white 4px
    );
}

.qr-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Pied de page */
.teouda-footer {
    background: #f8f9fa;
    border-top: 2px solid #d4af37;
    padding: 12px 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.consistoire-info {
    font-size: 12px;
    color: #666;
}

.last-update {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Responsive pour écrans plus petits */
@media (max-width: 1600px) {
    .main-content {
        gap: 40px;
        padding: 40px 30px;
    }
    
    .teouda-header {
        padding: 20px 30px;
    }
    
    .header-left h1 {
        font-size: 24px;
    }
    
    .current-date {
        font-size: 20px;
    }
    
    .current-time {
        font-size: 28px;
    }
    
    .main-title h2 {
        font-size: 40px;
    }
    
    .main-title h3 {
        font-size: 28px;
    }
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Animation pour les éléments dynamiques */
.status-indicator.valid {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.current-time {
    animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}
