/* style.css - Système Complet Bio-Naturel avec UI Admin/Auth */
:root {
  --primary: #8AA57E; /* Retour au Vert Sauge pour l'information générale */
  --primary-glow: rgba(138, 165, 126, 0.4);
  --secondary: #BC6C25; 
  --hive-red: #6B1C23; /* Couleur spécifique dédiée aux ruches */
  --bg-dark: #121417; 
  --card-bg: rgba(30, 34, 40, 0.85);
  --glass: rgba(18, 20, 23, 0.9);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-main: #F8FAFC;
  --text-dim: #94A3B8;
  --danger: #ef4444;
  --success: #8AA57E;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Outfit', 'Inter', sans-serif; }
.leaflet-container * { box-sizing: content-box; margin: initial; padding: initial; } /* Critical fix for Leaflet layout */

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  background: 
    linear-gradient(rgba(18, 20, 23, 0.8), rgba(18, 20, 23, 0.8)),
    url('../img/rucher_source.webp') no-repeat center center fixed;
  background-size: cover;
  min-height: 100vh;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
}

/* Header & Profil */
header {
  padding: 1rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(18, 20, 23, 0.95);
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-actions { display: flex; align-items: center; gap: 15px; }

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.user-avatar {
  background: var(--primary);
  color: #000;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem;
}

.logo {
  display: flex; align-items: center; gap: 12px; font-size: 1.5rem; font-weight: 800; color: var(--primary);
}
.logo span { color: inherit; }

/* Dashboard Layout */
.dashboard-container {
  display: grid;
  grid-template-columns: 310px 1fr 310px;
  gap: 1.5rem;
  padding: 1.5rem 2%;
  max-width: 1800px;
  margin: 0 auto;
}

aside { display: flex; flex-direction: column; gap: 1.5rem; }
main { display: flex; flex-direction: column; gap: 2rem; }

/* Widget & Stats */
.widget { padding: 1.8rem; }
.widget-title { font-size: 0.8rem; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 1.2rem; letter-spacing: 1.5px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.stat-card { padding: 1.5rem; text-align: center; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; }

/* Apiary Grid & Type Distinction */
.apiary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

.hive-card { 
    padding: 1.8rem; 
    transition: var(--transition); 
    cursor: pointer; 
    border: 1px solid var(--glass-border);
    border-top: 4px solid var(--primary);
    overflow: visible;
}

.hive-card.ruche { border-top-color: var(--hive-red); } /* Rouge pour les ruches uniquement */
.hive-card.ruchette { border-top-color: var(--secondary); }
.hive-card.nuclei { border-top-color: #3B82F6; }
.hive-card.externe { border-top-color: #a855f7; }

.hive-card:hover { transform: translateY(-5px); background: rgba(255, 255, 255, 0.05); }

.hive-header { display: flex; justify-content: space-between; margin-bottom: 1.2rem; }
.hive-id { font-size: 1.2rem; font-weight: 700; color: #FFF; }

.hive-type { font-size: 0.75rem; font-weight: 800; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.hive-type.ruche { background: rgba(107, 28, 35, 0.1); color: var(--hive-red); }
.hive-type.ruchette { background: rgba(188, 108, 37, 0.1); color: var(--secondary); }
.hive-type.nuclei { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }
.hive-type.externe { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.hive-bicolor-signal {
    display: flex;
    height: 10px;
    width: 100%;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1.2rem;
    border: 1px solid var(--glass-border);
}
.hive-bicolor-signal div {
    flex: 1;
    height: 100%;
}
.hive-status { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.2rem; }
.status-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.status-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; }
.status-val { font-size: 0.95rem; font-weight: 600; min-width: 0; }
.progress-container { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; margin-top: 5px; }
.progress-bar { height: 100%; background: var(--primary); }

/* Buttons */
.btn { padding: 10px 22px; border-radius: 12px; font-weight: 700; cursor: pointer; border: none; transition: var(--transition); }
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #000; }

/* Modals & Overlays */
.overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85);
  display: none; justify-content: center; align-items: center; backdrop-filter: blur(12px); z-index: 2000;
}
.modal { 
    background: var(--glass);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 95%; 
    max-width: 1000px; 
    max-height: 85vh;
    padding: 1.5rem; 
    position: relative; 
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}
.modal.modal-panel {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 1.2rem; flex-shrink: 0; }

.auth-tabs { display: flex; gap: 24px; margin-bottom: 1.5rem; border-bottom: 1px solid var(--glass-border); }
.auth-tab { padding-bottom: 12px; cursor: pointer; color: var(--text-dim); font-weight: 700; border-bottom: 3px solid transparent; transition: var(--transition); }
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.form-group { margin-bottom: 0.8rem; text-align: left; }
.form-group label { display: block; margin-bottom: 4px; font-size: 0.8rem; color: var(--text-dim); }
.form-input { width: 100%; padding: 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: 10px; color: #fff; font-size: 1rem; }
.form-input:focus { outline: none; border-color: var(--primary); }
.form-input option { background: var(--bg-dark); color: #fff; }

.auth-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 15px; display: none; background: rgba(239, 68, 68, 0.1); padding: 10px; border-radius: 8px; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Other components */
#map { border-radius: 15px; border: 1px solid var(--glass-border); margin-top: 10px; }
.marker-glow { filter: drop-shadow(0 0 10px var(--primary)); }
.no-arrow-popup .leaflet-popup-tip-container { display: none; }
.no-arrow-popup .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.crop-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--glass-border); }
.crop-status.blooming { color: var(--primary); font-weight: bold; text-shadow: 0 0 10px var(--primary-glow); }
.crop-status.upcoming { color: var(--text-dim); font-size: 0.8rem; }
.crop-status.finished { color: #64748B; opacity: 0.6; font-size: 0.8rem; text-decoration: line-through; }
.crown-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: default;
}
.crown-tooltip:hover::after {
    opacity: 1;
}
.queen-badge { background: var(--secondary); color: #FFF; padding: 2px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: bold; }
.db-status { font-size: 0.7rem; color: var(--primary); border: 1px solid var(--primary); padding: 2px 10px; border-radius: 20px; }
.news-feed { 
    max-height: 350px; 
    overflow-y: auto; 
    padding-right: 8px; /* For scrollbar space */
}
.news-feed::-webkit-scrollbar { width: 4px; }
.news-feed::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 2px; }
.news-feed::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }

/* Media Queries */
@media (max-width: 1024px) {
  .dashboard-container { grid-template-columns: 1fr; }
}

/* Presentation Card & Branding Content */
.presentation-card {
  padding: 3.5rem;
  text-align: center;
  max-width: 900px;
  margin: 1rem auto 3rem auto;
  animation: fadeIn 0.8s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.presentation-card h1 {
  font-family: 'Outfit';
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.presentation-subtitle {
  font-size: 1.3rem;
  color: var(--text-main);
  margin-bottom: 2.5rem;
  font-weight: 600;
  opacity: 0.9;
}

.presentation-content {
  text-align: left;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 3rem;
  font-size: 1.05rem;
}

.presentation-content p {
  margin-bottom: 1.5rem;
}

.presentation-footer {
  width: 100%;
  border-top: 1px solid var(--glass-border);
  padding-top: 2.5rem;
}

/* History Feed within Hive Modal */
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 2px; }
.history-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Honey Labels */
.label-preview-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.honey-label {
    width: 320px;
    height: auto;
    min-height: 180px;
    background: #fff;
    color: #001f3f;
    border: none;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    font-family: 'Inter', sans-serif;
}

.label-header {
    font-family: 'Outfit';
    font-size: 1.5rem;
    font-weight: 800;
    color: #8AA57E;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    width: 100%;
    margin-bottom: 2px;
}

.label-logo {
    width: 45px;
    height: 45px;
}

.label-main-text {
    font-size: 1.1rem;
    font-weight: 900;
    margin: 1px 0;
    color: #001f3f;
    text-transform: uppercase;
}

.label-type {
    font-size: 0.9rem;
    font-weight: 700;
    color: #001f3f;
    font-style: italic;
}

.label-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.7rem;
    font-weight: 800;
    color: #001f3f;
    border-top: 1px solid #eee;
    padding-top: 4px;
    margin-top: 2px;
}

