/* =========================================
   1. CSS Variables & Theme Defaults
   ========================================= */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #F4F4F4;
  --gap: 20px;
  --primary-color: #048B9A;
  --btn-discover: steelblue;
  --sidebar-width: 250px;
}

/* =========================================
   2. Global Body Styles
   ========================================= */
body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  margin: 0;
  padding-bottom: 60px;
}

input[type="checkbox"] {
  transform: scale(1.4);
  margin: 0;
  margin-top: 2px;
}

/* =========================================
   3. Header Layout (Two-Row System)
   ========================================= */

.header {
  text-align: center;
  padding: var(--gap);
}

.header-top-row {
  display: flex;
  justify-content: space-between; /* Pushes Link to far left */
  align-items: center;
  width: 100%;
}

.header a.logo-link img {
  height: 35px; /* Forces the size regardless of other rules */
  transition: transform 0.3s;
  display: block;
}

.header a.logo-link img:hover {
  transform: scale(1.1);
}

.title {
  margin: 30px 0 0 0;
  font-family: 'Segoe UI Black', sans-serif;
  font-size: 24px;
  color: #333;
}

.subtitle {
  text-align: center;
  padding-left: var(--gap);
  padding-right: var(--gap);
  max-width: 75ch;
  margin: auto;
  font-size: 18px;
  color: #333;
}

/* =========================================
   4. Main Layout (Grid + Sticky Sidebar)
   ========================================= */

.main-layout {
  display: flex;
  align-items: flex-start; /* Critical for sticky to work */
  gap: var(--gap);
  padding: var(--gap);
  margin: auto;
}

/* Left Side: Tile Grid */
.container-wrapper {
  flex: 1; /* Takes all remaining width */
  width: 100%;
}

.checkbox-group {
  display: grid;
  /* Auto-fit creates as many columns as fit, min 250px wide */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* Service Tile Styling */
.service-tile {
  background: white;
  border: 3px solid #ddd;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  transition: transform 0.2s;
}

.service-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 12px rgba(0,0,0,0.1);
}

.tile-image {
  width: auto;
  height: 75px;
  object-fit: contain;
  margin-bottom: 15px;
}

.tile-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #333;
  min-height: 40px; /* Aligns buttons if titles vary */
}

.tile-price {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 15px;
}

/* Buttons */
.btn-discover {
  display: block;
  width: 100%;
  padding: 12px 0;
  margin-bottom: 10px;
  background-color: var(--btn-discover);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.2s;
  box-sizing: border-box;
}

.btn-discover:hover {
  background-color: #386890; /* Darker steelblue */
}

/* Custom Checkbox Button */
.btn-add {
  display: block;
  width: 100%;
  padding: 12px 0;
  background-color: var(--primary-color);
  color: white;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-sizing: border-box;
  user-select: none;
}

.btn-add:hover {
  background-color: #037a87;
}

.btn-add:active {
  transform: scale(0.98);
}

/* Hide the actual checkbox input but keep it functional */
.btn-add input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Style when checked */
.btn-add:has(input:checked) {
  background-color: #4caf50; /* Darker shade for active state */
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Disabled State for "Ajoutez à la sélection" */
.btn-add-disabled {
  display: block;
  width: 100%;
  padding: 12px 0;
  box-sizing: border-box;
  /* Visual Style */
  background-color: #e0e0e0; /* Light grey background */
  color: #757575;            /* Dark grey text */
  border-radius: 6px;        /* Matches active button rounding */
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  /* Interaction */
  cursor: not-allowed;       /* Shows 'no entry' symbol */
  pointer-events: none;      /* Prevents clicking */
  user-select: none;         /* Prevents text selection */
  /* Reset active effects */
  box-shadow: none;
  transform: none;
  opacity: 1; /* Keep fully opaque so it looks solid, not faded */
}

/* Ensure the checkbox inside is also ignored */
.btn-add-disabled input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Right Side: Sticky Sidebar */
.sidebar-container {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 20px; /* Sticks 20px from top */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.progress-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 3px solid var(--primary-color);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

.progress-price-row {
  display: flex;
  flex-direction: row;    /* CRITICAL: Keeps Bar and Price horizontal */
  align-items: flex-start;/* Aligns Price to the top of the Bar */
  width: 100%;
  justify-content: center;
}

.progress-container {
  height: 545px; /* Set desired height */
  width: 30px;
  background-color: #e0e0e0;
  border: 2px solid black;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  margin-left: 80px;
}

.progress-bar {
  width: 100%;
  height: 0%; /* Controlled by JS */
  background-color: #4caf50;
  border-radius: 0;
  transition: height 0.3s ease;
}

.value-display {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  min-width: 7ch;
  margin-left: 10px;
}

#message {
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: #333;
  background: white;
  padding: 20px 0 0 0;
}

/* Footer */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  margin-top: 30px;
  background-color: #f0f0f0;
  padding: 20px 0;
  font-size: 15px;
  text-align: center;
  border-top: 1px solid #ddd;
  z-index: 100;
}

/* =========================================
   5. Mobile Responsiveness
   ========================================= */

@media (max-width: 600px) {
  body {
    padding-bottom: 60px;
  }
  
  .header {
    text-align: center;
    padding: 10px 5px 10px 5px;
  }
  
  .header-top-row {
    justify-content: center;
  }
  
  .title {
    margin: 10px 0 0 0;
  }
  
  .subtitle {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .main-layout {
    gap: 5px;
    padding: 5px;
    margin: auto;
  }
  
  .container-wrapper {
    flex: 0 0 50%;
    max-width: 100%;
  }

  .service-tile {
    padding: 10px 5px 10px 5px;
  }
  
  .checkbox-group {
    gap: 5px;
  }
  
  .progress-wrapper {
    padding: 10px 5px 5px 5px;
  }
  
  .progress-container {
    height: 280px; /* Set desired height */
    width: 30px;
    margin-left: 60px;
  }
  
  .sidebar-container {
    width: 180px;
    top: 5px;
  }
}

/* =========================================
   6. Custom tiles colors
   ========================================= */

.tile-blue { background-color: #e3f2fd; border-color: #90caf9; }
.tile-green { background-color: #e8f5e9; border-color: #a5d6a7; }
.tile-orange { background-color: #fff3e0; border-color: #ffcc80; }
.tile-purple { background-color: #f3e5f5; border-color: #ce93d8; }   
/* etc... */   
