/* ============================================================
   GASSIN — Ma maison à Gassin
   Charte graphique Provence : ocre, marine, pins, mer, sable
   ============================================================ */

:root {
  --marine:       #123B5B;
  --marine-deep:  #0B2A42;
  --marine-soft:  #1D507A;
  --bleu-ciel:    #8FC1DC;
  --bleu-pale:    #DCEEF7;
  --ocre:         #C9873B;
  --ocre-clair:   #E3B87C;
  --ocre-pale:    #F3E2C4;
  --sable:        #F6EFE2;
  --pin:          #2F5D4F;
  --pin-clair:    #4C7F6E;
  --blanc:        #FFFDF8;
  --encre:        #22303B;
  --gris:         #6B7A86;
  --danger:       #C0392B;
  --succes:       #2E8B57;
  --rayon:        18px;
  --ombre:        0 10px 30px rgba(11, 42, 66, .12);
  --font-titre:   "Cormorant Garamond", Georgia, serif;
  --font-texte:   "Poppins", "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-texte);
  color: var(--encre);
  background: var(--sable);
  -webkit-font-smoothing: antialiased;
}

/* ================= PAGE DE CONNEXION ================= */

.login-page {
  display: flex;
  min-height: 100vh;
  background: var(--marine-deep);
}

.login-side {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 32px;
  background:
    radial-gradient(1200px 500px at -10% -10%, rgba(201, 135, 59, .18), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(79, 130, 163, .25), transparent 55%),
    linear-gradient(160deg, var(--marine) 0%, var(--marine-deep) 100%);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

.login-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/static/img/pins-motif.svg");
  background-size: 260px 260px;
  opacity: .10;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: auto;               /* centrage + scroll correct si l'écran est petit */
  position: relative;
  z-index: 2;
  background: rgba(255, 253, 248, .97);
  border-radius: 24px;
  padding: 44px 40px 36px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
}

.brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand .sun-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: block;
}

.brand h1 {
  font-family: var(--font-titre);
  font-size: 34px;
  font-weight: 700;
  color: var(--marine);
  letter-spacing: .5px;
}

.brand .sous-titre {
  font-size: 13px;
  color: var(--gris);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.brand .sous-titre span { color: var(--ocre); font-weight: 600; }

.login-card h2 {
  font-family: var(--font-titre);
  font-size: 24px;
  color: var(--marine-deep);
  margin-bottom: 4px;
}

.login-card .intro {
  font-size: 13.5px;
  color: var(--gris);
  margin-bottom: 22px;
}

.champ { margin-bottom: 16px; }

.champ label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--marine-soft);
  margin-bottom: 6px;
}

.champ input {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid #E4D9C4;
  border-radius: 12px;
  font-size: 15px;
  font-family: var(--font-texte);
  background: var(--blanc);
  color: var(--encre);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.champ input:focus {
  border-color: var(--ocre);
  box-shadow: 0 0 0 4px rgba(201, 135, 59, .15);
}

.btn-principal {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-texte);
  color: var(--blanc);
  background: linear-gradient(135deg, var(--ocre) 0%, #B06F2C 100%);
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 8px 20px rgba(201, 135, 59, .35);
  letter-spacing: .5px;
}

.btn-principal:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(201, 135, 59, .45); }
.btn-principal:active { transform: translateY(0); }

.erreur {
  background: #FDEBE9;
  border: 1px solid #F5C6C0;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
  text-align: center;
}

.login-pied {
  text-align: center;
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--gris);
}

.login-pied .pins { color: var(--pin); font-weight: 500; }

.login-visuel {
  flex: 1.4;
  position: relative;
  min-height: 480px;
}

.login-visuel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-visuel .legende {
  position: absolute;
  left: 32px;
  bottom: 28px;
  color: var(--blanc);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  max-width: 380px;
}

.login-visuel .legende h2 {
  font-family: var(--font-titre);
  font-size: 30px;
  font-weight: 600;
}

.login-visuel .legende p { font-size: 14px; opacity: .92; }

@media (max-width: 900px) {
  .login-page { flex-direction: column; }
  .login-visuel { min-height: 190px; order: -1; }
  .login-side { padding: 24px 20px 32px; }
  .login-card { padding: 32px 24px 28px; }
}

/* ================= APPLICATION (dashboard) ================= */

.app-header {
  background: linear-gradient(120deg, var(--marine-deep) 0%, var(--marine) 55%, var(--marine-soft) 100%);
  color: var(--blanc);
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(143, 193, 220, .35), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 24px 0;
  position: relative;
  z-index: 2;
}

.header-haut {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.titre-site {
  display: flex;
  align-items: center;
  gap: 14px;
}

.titre-site .sun-logo { width: 46px; height: 46px; }

.titre-site h1 {
  font-family: var(--font-titre);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
}

.titre-site small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--bleu-ciel);
}

.utilisateur {
  display: flex;
  align-items: center;
  gap: 14px;
}

.utilisateur .nom {
  font-size: 13px;
  color: var(--bleu-pale);
  text-align: right;
}

.btn-deconnexion {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .25);
  color: var(--blanc);
  font-family: var(--font-texte);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
}

.btn-deconnexion:hover { background: rgba(255, 255, 255, .2); }

/* Onglets */
.onglets {
  display: flex;
  gap: 6px;
  padding-bottom: 0;
}

.onglet {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px 13px;
  border-radius: 14px 14px 0 0;
  color: rgba(255, 255, 255, .72);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .2s, color .2s;
  border: none;
  background: transparent;
  cursor: pointer;
}

.onglet:hover { color: var(--blanc); background: rgba(255, 255, 255, .08); }

.onglet.actif {
  background: var(--sable);
  color: var(--marine);
  font-weight: 600;
}

.onglet .icone { width: 20px; height: 20px; }

.onglet .badge-prochainement {
  font-size: 9.5px;
  background: var(--ocre);
  color: var(--blanc);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Contenu */
.app-contenu {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.titre-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.titre-page h2 {
  font-family: var(--font-titre);
  font-size: 28px;
  font-weight: 700;
  color: var(--marine-deep);
}

.titre-page .sous-titre { font-size: 13.5px; color: var(--gris); }

.etat-demo {
  background: var(--ocre-pale);
  border: 1px dashed var(--ocre);
  color: #8A5A1E;
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.etat-demo::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ocre);
  box-shadow: 0 0 0 4px rgba(201, 135, 59, .2);
}

.actions-titre {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-ouvrir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--marine);
  color: var(--blanc);
  font-family: var(--font-texte);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, transform .15s;
  box-shadow: 0 6px 16px rgba(18, 59, 91, .3);
}

.btn-ouvrir:hover { background: var(--marine-soft); transform: translateY(-1px); }

/* Grille cartes */
.grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.carte {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 24px;
  border: 1px solid rgba(18, 59, 91, .06);
}

.carte h3 {
  font-family: var(--font-titre);
  font-size: 19px;
  font-weight: 700;
  color: var(--marine);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.carte h3 .emoji { font-size: 20px; }

/* Carte ballon principale */
.carte-ballon {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--blanc) 0%, #F3F9FD 100%);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 26px;
  align-items: center;
}

.ballon-visuel {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #EAF4FA, var(--bleu-ciel));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .6), 0 8px 20px rgba(143, 193, 220, .4);
  position: relative;
}

.ballon-visuel svg { width: 64px; height: 64px; }

.ballon-visuel.chauffe { background: radial-gradient(circle at 35% 30%, #FCEEDC, var(--ocre-clair)); box-shadow: inset 0 0 0 6px rgba(255,255,255,.6), 0 8px 20px rgba(201,135,59,.45); }

.temp-zone { text-align: center; }

.temp-zone .temp-actuelle {
  font-family: var(--font-titre);
  font-size: 64px;
  font-weight: 700;
  color: var(--marine-deep);
  line-height: 1;
}

.temp-zone .temp-actuelle sup { font-size: 26px; }

.temp-zone .libelle { font-size: 12.5px; color: var(--gris); letter-spacing: 1px; text-transform: uppercase; margin-top: 6px; }

.pastille-etat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 30px;
  margin-top: 10px;
}

.pastille-etat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }

.pastille-etat.chauffe { background: #FDEEDB; color: #9A641F; }
.pastille-etat.chauffe::before { background: var(--ocre); box-shadow: 0 0 0 4px rgba(201,135,59,.22); animation: pulse 1.4s infinite; }
.pastille-etat.veille { background: #E6F2FA; color: var(--marine-soft); }
.pastille-etat.veille::before { background: var(--bleu-ciel); }
.pastille-etat.eteint { background: #ECEFF1; color: var(--gris); }
.pastille-etat.eteint::before { background: var(--gris); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.details-ballon {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail {
  background: var(--sable);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 110px;
}

.detail .valeur { font-size: 17px; font-weight: 600; color: var(--marine); }
.detail .valeur small { font-size: 12px; color: var(--gris); font-weight: 400; }
.detail .nom { font-size: 11px; color: var(--gris); text-transform: uppercase; letter-spacing: .8px; }

/* Contrôles */
.controles { display: flex; flex-direction: column; gap: 22px; }

.bloc-controle h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--marine-soft);
  margin-bottom: 10px;
}

.interrupteur {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  width: 58px;
  height: 32px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch .curseur {
  position: absolute;
  inset: 0;
  background: #CFD8DE;
  border-radius: 30px;
  cursor: pointer;
  transition: background .25s;
}

.switch .curseur::before {
  content: "";
  position: absolute;
  width: 24px; height: 24px;
  left: 4px; top: 4px;
  background: var(--blanc);
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.switch input:checked + .curseur { background: var(--pin); }
.switch input:checked + .curseur::before { transform: translateX(26px); }

.interrupteur .texte { font-size: 14px; font-weight: 500; color: var(--encre); }

.modes { display: flex; gap: 10px; flex-wrap: wrap; }

.mode {
  border: 1.5px solid #E4D9C4;
  background: var(--blanc);
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font-texte);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--encre);
  cursor: pointer;
  transition: all .2s;
}

.mode .mode-nom { font-weight: 600; display: block; font-size: 14px; }
.mode .mode-temp { font-size: 11.5px; color: var(--gris); }

.mode.actif {
  border-color: var(--pin);
  background: rgba(47, 93, 79, .08);
  color: var(--pin);
  box-shadow: 0 0 0 3px rgba(47, 93, 79, .12);
}

.mode.actif .mode-temp { color: var(--pin-clair); }

.curseur-temp {
  display: flex;
  align-items: center;
  gap: 16px;
}

.curseur-temp input[type="range"] {
  flex: 1;
  accent-color: var(--ocre);
  height: 6px;
  cursor: pointer;
}

.curseur-temp .valeur-cible {
  font-family: var(--font-titre);
  font-size: 30px;
  font-weight: 700;
  color: var(--marine-deep);
  min-width: 62px;
  text-align: center;
}

.btn-action {
  padding: 11px 20px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-texte);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--marine);
  color: var(--blanc);
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.btn-action:hover { background: var(--marine-soft); transform: translateY(-1px); }
.btn-action:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Historique */
.historique { list-style: none; }

.historique li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #F0E8D8;
  font-size: 13.5px;
}

.historique li:last-child { border-bottom: none; }

.historique .heure {
  font-size: 12px;
  color: var(--gris);
  min-width: 58px;
  font-variant-numeric: tabular-nums;
}

.historique .evt {
  background: var(--bleu-pale);
  color: var(--marine-soft);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 500;
}

.historique .txt { flex: 1; }

/* Onglet caméras — placeholder */
.placeholder-cameras {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 60px 30px;
  text-align: center;
  border: 1px dashed #D8CDB8;
}

.placeholder-cameras .illus { width: 140px; height: 140px; margin: 0 auto 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--bleu-pale), var(--bleu-ciel)); display: flex; align-items: center; justify-content: center; }

.placeholder-cameras h3 {
  font-family: var(--font-titre);
  font-size: 26px;
  color: var(--marine);
  margin-bottom: 8px;
}

.placeholder-cameras p { color: var(--gris); font-size: 14.5px; max-width: 480px; margin: 0 auto; }

.placeholder-cameras .points { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }

.placeholder-cameras .points .point { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; background: var(--sable); border: 1.5px solid #E4D9C4; }

/* Carte iframe (interface appareil) */
.carte-iframe {
  padding: 14px;
  background: var(--marine-deep);
}

.carte-iframe iframe {
  width: 100%;
  height: 76vh;
  min-height: 520px;
  border: none;
  border-radius: 12px;
  background: var(--blanc);
}

.iframe-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 0 6px;
  font-size: 12.5px;
  color: var(--bleu-pale);
}

.iframe-note .puce {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ocre);
  flex-shrink: 0;
}

/* Notification toast */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--marine-deep);
  color: var(--blanc);
  padding: 13px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .3);
  opacity: 0;
  transition: transform .3s, opacity .3s;
  z-index: 100;
  pointer-events: none;
}

.toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.erreur { background: var(--danger); }

.pied-page {
  text-align: center;
  font-size: 12px;
  color: var(--gris);
  padding: 18px 0 34px;
}

.pied-page .coeur { color: var(--ocre); }

/* Responsive */
@media (max-width: 820px) {
  .carte-ballon { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .details-ballon { justify-content: center; }
  .controles { align-items: center; }
  .header-haut { flex-direction: column; gap: 12px; }
  .utilisateur { width: 100%; justify-content: space-between; }
}
