/* ==========================================================
   style.css – Modern Glass / Material UI
   Theme: Blue-Gray Palette for Ramani Foods Dashboard
   Optimized for invoices, food samples, and modal forms.
   ========================================================== */

:root {
  --bg-1: #f4f7fb;
  --card-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --primary: #2f80ed;
  --primary-600: #256fd6;
  --accent: #1f2937;
  --muted: #6b7a90;
  --success: #27ae60;
  --danger: #e74c3c;
  --shadow-1: 0 6px 18px rgba(31, 41, 55, 0.08);
  --shadow-2: 0 10px 30px rgba(31, 41, 55, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --glass-blur: 8px;
  --max-width: 1200px;
  --table-row-height: 56px;
  --mobile-break: 900px;
  --scroll-padding-top: 90px;

}

/* ==================== Base Layout ==================== */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #eef4fb 0%, #f8fbff 100%);
  color: var(--accent);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 24px;
    overflow-x: auto;   /* allows side scroll for wide tables */
  overflow-y: scroll; /* main page scroll */
}

.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
}

/* ==================== Glass Cards ==================== */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(246,250,255,0.86));
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-1);
  border: 1px solid rgba(47,128,237,0.08);
}

/* ==================== Header ==================== */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.header-left {
  display: flex;
  gap: 12px;
  align-items: center;
}
.header-left h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary);
}

/* ==================== Controls ==================== */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.controls + .controls-row { margin-top: 8px; }
.controls-row button { min-width: 140px; }

.select, select, input[type="number"] {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(47,72,88,0.08);
  background: #fff;
  min-height: 38px;
  font-size: 0.95rem;
  color: var(--accent);
  outline: none;
  transition: box-shadow .15s ease, border-color .12s ease;
}
.select:focus, select:focus, input[type="number"]:focus {
  box-shadow: 0 6px 18px rgba(47,128,237,0.12);
  border-color: var(--primary-600);
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  min-height: 38px;
  border: none;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: #fff;
  box-shadow: 0 6px 18px rgba(47,128,237,0.16);
  transition: transform .08s ease, opacity .12s ease;
}
.btn.secondary {
  background: transparent;
  color: var(--primary-600);
  border: 1px solid rgba(47,128,237,0.12);
  box-shadow: none;
}
.btn:hover { opacity: 0.95; }
.btn:active { transform: translateY(1px); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==================== Sticky Controls ==================== */
.controls-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ==================== Split Layout ==================== */
.split-card {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  padding: 20px;
}
/* ---------- Compact Controls (Inline Selectors) ---------- */
.compact-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
}

.compact-controls .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select.small {
  width: 140px;
  min-width: 120px;
  max-width: 160px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

/* Optional: Align buttons on same visual line for wide screens */
@media (min-width: 900px) {
  .btn-group,
  .controls-row {
    margin-top: 6px;
  }
}

/* Stack neatly on mobile */
@media (max-width: 700px) {
  .compact-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .select.small {
    width: 100%;
    max-width: 100%;
  }
}

.left-pane {
  flex: 1;
  padding-right: 20px;
  border-right: none;
}
.right-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 240px;
  text-align: center;
}
.right-pane h4 {
  margin-bottom: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

/* ==================== Table ==================== */
table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow: visible; /* remove internal scrolling */
  border-radius: 10px;
  margin-top: 10px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(15,23,42,0.03);
  box-shadow: var(--shadow-2);
}

#calendarTable {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
}
/* === Keep school names fixed to top of viewport === */
/* === Keep full school name row fixed at top (aligned columns) === */





/* Action icons styling for Food Sample table */
.action-icons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.action-icons i {
  cursor: pointer;
  font-size: 16px;
  color: #003366cc;
  transition: all 0.2s ease;
  padding: 6px;
  border-radius: 8px;
  backdrop-filter: blur(3px);
}

.action-icons i:hover {
  transform: scale(1.15);
}

.action-icons .fa-edit:hover {
  color: #2e7d32; /* greenish */
}

.action-icons .fa-trash:hover {
  color: #c62828; /* red */
}

/* ==================== Modal ==================== */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-dialog {
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(15px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(31,38,135,0.2);
  padding: 20px 24px;
  width: 550px;
  max-width: 100%;
  animation: slideIn 0.3s ease;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #003366;
}
.close {
  font-size: 22px;
  color: #333;
  cursor: pointer;
  transition: 0.2s;
}
.close:hover { color: #e53935; }

/* ==================== Modal Form ==================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }

label {
  font-size: 13px;
  color: #444;
  display: block;
  margin-bottom: 4px;
}
input, select, textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.85);
  font-size: 13px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
.modal-footer {
  margin-top: 16px;
  text-align: right;
}

/* ==================== Animations ==================== */
@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==================== Responsive ==================== */
/* ===============================
   💻 Desktop Layout
   =============================== */
.controls-sticky.split-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  position: relative; /* let it scroll with the page */
  top: auto;
  z-index: auto;
}

.left-pane {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.right-pane {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.divider {
  width: 1px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.05));
  align-self: stretch;
  margin: 0 16px;
  border: none;
}

.controls,
.controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

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

.foodsample-group h4,
.right-pane h4 {
  margin-bottom: 8px;
}

/* =========================================
   🎨 Compact Dropdown Styling
   ========================================= */
.select {
  appearance: none;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 6px 28px 6px 10px; /* smaller padding */
  font-size: 14px;
  color: #111;
  line-height: 1.3;
  cursor: pointer;
  height: 36px; /* smaller height */
  width: auto; /* no full width */
  min-width: 100px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select:hover {
  border-color: rgba(0,0,0,0.25);
}

.select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

/* make inline with labels */
.controls label,
.controls-row label {
  margin-right: 6px;
  font-size: 14px;
}

/* space between label + select + buttons */
.controls-row,
.controls {
  flex-wrap: wrap;
  gap: 10px;
}

/* prevent selects from stretching */
.controls .select,
.controls-row .select {
  flex: 0 0 auto;
}

/* for mobile layout keep 100% width */
@media (max-width: 768px) {
  .select {
    width: 100%;
  }
}




/* ==================== Utilities ==================== */
button:focus, .select:focus, input:focus {
  outline: 3px solid rgba(47,128,237,0.14);
  outline-offset: 2px;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.success { color: var(--success); }
.error { color: var(--danger); }

/* ===============================
   📱 MOBILE LAYOUT
   =============================== */
/* ================================================
   📱 FIXED MOBILE LAYOUT (exactly like screenshot)
   ================================================ */
/* ===============================
   MOBILE LAYOUT (final)
   =============================== */
@media (max-width: 768px) {
  .split-card {
    flex-direction: column;
    padding: 0;
    border-radius: 12px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    overflow: hidden;
  }

  /* Real header */
  .mobile-header {
    display: block;
    width: 100%;
    height: 48px;
    line-height: 48px;
    text-align: center;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 12px 12px 0 0;
  }

  /* hide content until expanded */
  .split-card .left-pane,
  .split-card .right-pane {
    display: none;
  }

  /* show when expanded */
  .split-card.expanded .left-pane,
  .split-card.expanded .right-pane {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    align-items: center;
  }

  /* left-aligned labels with centered inputs (like your screenshot) */
  .left-pane label {
    width: 100%;
    text-align: left;
    margin-left: 6%;
    font-size: 13px;
    color: #333;
    margin-bottom: 4px;
  }

  .left-pane .select {
    width: 80%;
    min-width: 180px;
    max-width: 240px;
    text-align: center;
    margin-bottom: 6px;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 80%;
    align-items: center;
  }

  .btn, .btn.secondary {
    width: 80%;
    justify-content: center;
  }

  /* Month & Year stacked labels-left, inputs centered */
  .controls-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .controls-row label { align-self: flex-start; margin-left: 10%; }

  #month, #year {
    width: 80%;
    min-width: 180px;
    max-width: 240px;
    text-align: center;
  }

  /* Rebuild + Save side-by-side row */
  .controls-row.actions-row {
    flex-direction: row;
    justify-content: center;
    gap: 16px;
    width: 100%;
  }
  #regen, #saveFeed { width: 40%; min-width: 120px; max-width: 160px; }

  /* right pane (Food Sample) centered */
  .right-pane {
    width: 100%;
    text-align: center;
    align-items: center;
    margin-top: 6px;
  }
  .right-pane h4 { margin-bottom: 8px; font-size: 15px; }
  .right-pane button { min-width: 150px; width: 60%; }

  /* hide visual divider on mobile */
  .divider { display: none; }
}

/* =========================================
   🖥️ Desktop: Hide "☰ Controls" header
   ========================================= */
@media (min-width: 769px) {
  .mobile-header {
    display: none !important;
  }
}

/* === Keep both school names (thead) and date column sticky === */
/* === Keep both school names (thead) and date column sticky === */

/* Wrapper scrolls normally */
/* .table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
} */

/* 🧭 Keep the school names (header) visible when scrolling */
#calendarHead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: #fff;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Header cell style */
#calendarHead th {
  color: #fff;
  font-weight: 600;
  text-align: center;
  padding: 10px 8px;
  height: 48px;
  vertical-align: middle;
  white-space: normal;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* 📅 Keep the date column fixed on the left */
#calendarTable th:first-child,
#calendarTable td:first-child {
  position: sticky;
  left: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-right: 1px solid rgba(0,0,0,0.05);
}


/* Ensure the top-left cell layers above others */
#calendarHead th:first-child {
  z-index: 120;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
}

