:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --secondary: #64748b;
  --bg-app: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --border: #e2e8f0;
  --accent: #10b981;
  --warning: #ef4444;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
}

/* --- Layout --- */
.main-header {
  background: white;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 500;
}

.header-right {
  display: flex;
  gap: 0.75rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.logo span { color: var(--accent); }

.tagline {
  font-size: 0.875rem;
  color: var(--secondary);
  font-style: italic;
}

.btn-export {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-export:hover {
  background: var(--bg-app);
  border-color: var(--primary);
  color: var(--primary);
}

.app-container {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.schedule-section { flex: 3; }
.sidebar { flex: 1; min-width: 320px; display: flex; flex-direction: column; gap: 1.5rem; }

/* --- Components --- */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

h3 {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.section-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

/* --- Form Elements --- */
input, select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.checkbox-group {
  margin-bottom: 1.5rem;
}

.check-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 8px;
  cursor: pointer;
}

.check-container input { width: auto; margin: 0; }

.meal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.meal-row input { width: 60px; margin-bottom: 0; }

/* --- Buttons --- */
.btn-add, .btn-generate {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add { background: var(--primary); color: white; }
.btn-add:hover { background: var(--primary-dark); }

.btn-generate { 
  background: var(--accent); 
  color: white; 
  margin-top: 1rem;
}

/* --- The Grid (CRITICAL) --- */
.grid {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  border: 1px solid var(--border);
  background: #fff;
  position: relative; /* Needed for event-card absolute positioning */
  overflow: hidden;
}

.cell {
  min-height: 75px; 
  height: auto;     
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column; 
  gap: 6px;
  padding: 10px;
  font-size: 0.75rem;
  align-items: flex-start;
  justify-content: flex-start;
}

.cell.header {
  background: #f1f5f9;
  font-weight: 700;
  height: 45px;
  align-items: center;
  justify-content: center;
}

.cell.time-label {
  background: #f8fafc;
  font-weight: 600;
  color: var(--secondary);
  align-items: center;
  justify-content: center;
  min-height: 75px;
}

/* --- Dynamic Elements --- */
.event-card {
  position: relative;   
  width: 100%;          
  border-radius: 6px;
  padding: 6px;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  border-left: 4px solid var(--primary); 
  background: #f1f5f9;   
  pointer-events: auto;  
}

.warning-banner {
  background: #fee2e2;
  color: #991b1b;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--warning);
  margin-top: 1rem;
  font-size: 0.85rem;
}

.med-list { list-style: none; }
.med-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.delete-btn {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  max-width: 600px;
  text-align: left;
}

.instructions-card {
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.intro-section {
  background: #f0f9ff;
  border-left: 4px solid var(--accent);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.intro-section p {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.intro-section p:last-child {
  margin-bottom: 0;
}

.instructions-content {
  margin-bottom: 1.5rem;
}

.instructions-content h4 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.instructions-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.instructions-content li {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
}

.instructions-content li:last-child {
  margin-bottom: 0;
}

.disclaimer-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: #991b1b;
  line-height: 1.6;
  font-style: italic;
}

.disclaimer-title { color: var(--warning); font-size: 1.25rem; }
.empty-state {
  text-align: center;
  color: var(--secondary);
  font-size: 0.85rem;
  padding: 1rem 0;
}


