/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0f19;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* Dashboard Wrapper Layout */
.dashboard-wrapper {
  display: grid;
  grid-template-columns: 360px 1fr;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Left Sidebar Styles */
.sidebar {
  background-color: #111827;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 2rem;
  height: 100vh;
  overflow: hidden;
}

.sidebar-top {
  margin-bottom: 2.5rem;
}

.time-display {
  font-size: 5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -2px;
  color: #ffffff;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.date-display {
  font-size: 1.6rem;
  font-weight: 600;
  color: #9ca3af;
  margin-top: 0.5rem;
  text-transform: capitalize;
}

/* Sidebar Agenda Styles */
.agenda-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e5e7eb;
  margin-bottom: 1.2rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 2px solid #374151;
  padding-bottom: 0.5rem;
}

.agenda-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  /* Custom scrollbar for webkit */
}

.agenda-list::-webkit-scrollbar {
  width: 6px;
}
.agenda-list::-webkit-scrollbar-track {
  background: transparent;
}
.agenda-list::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 4px;
}

.agenda-loading,
.agenda-empty {
  font-size: 1.2rem;
  color: #6b7280;
  text-align: center;
  padding: 2rem 0;
  font-style: italic;
}

.agenda-day-group {
  margin-bottom: 1.5rem;
}

.agenda-day-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 0.6rem;
}

.agenda-item {
  background-color: #1f2937;
  border-left: 4px solid #9ca3af;
  border-radius: 0 8px 8px 0;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.agenda-item-time {
  font-size: 1rem;
  font-weight: 700;
  color: #d1d5db;
  margin-bottom: 0.2rem;
}

.agenda-item-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  white-space: normal;
  word-wrap: break-word;
}

/* Main Content Panel Styles */
.main-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 2rem;
  overflow: hidden;
}

/* Header Styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.app-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.sync-status {
  font-size: 1rem;
  color: #10b981;
  margin-top: 0.2rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sync-status.sync-error {
  color: #f87171;
}

.sync-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Toggle Switch Group */
.toggle-group {
  background-color: #1f2937;
  padding: 0.4rem;
  border-radius: 12px;
  display: flex;
  gap: 0.2rem;
}

.toggle-btn {
  background: transparent;
  border: none;
  outline: none;
  color: #9ca3af;
  padding: 0.8rem 1.6rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background-color: #374151;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Calendar Container */
.calendar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Weekday Titles */
.weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #9ca3af;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}

.weekdays-header div {
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Calendar Grid general */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
  gap: 1px;
  background-color: #1f2937; /* Forms the borders between grid cells */
  border: 1px solid #1f2937;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0.5rem;
}

/* Views layouts adjustments */
.calendar-grid.view-two-week {
  grid-template-rows: repeat(2, 1fr);
}

.calendar-grid.view-month {
  grid-template-rows: repeat(5, 1fr);
}

.calendar-grid.view-month-six {
  grid-template-rows: repeat(6, 1fr);
}

/* Calendar Grid Day Cell */
.calendar-day {
  background-color: #0f172a;
  display: flex;
  flex-direction: column;
  padding: 0.8rem;
  position: relative;
  overflow: hidden;
}

/* Other month days in month view */
.calendar-day.other-month {
  background-color: #0b0f19;
  opacity: 0.45;
}

/* Today highlight */
.calendar-day.today {
  background-color: #131d35;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

.day-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.calendar-day.today .day-number {
  background-color: #3b82f6;
  color: #ffffff;
}

.day-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #3b82f6;
  text-transform: uppercase;
}

/* Event List inside a Day Cell */
.day-events {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.1rem;
}

.day-events::-webkit-scrollbar {
  width: 3px;
}
.day-events::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 2px;
}

/* Calendar Event Card */
.event-card {
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-left: 5px solid #9ca3af;
  background-color: #1e293b;
  overflow: hidden;
}

.event-time {
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 0.15rem;
}

.event-title {
  white-space: normal;
  word-wrap: break-word;
  font-weight: 600;
}

/* All Day Events style modifications */
.event-card.all-day {
  border-left-width: 0;
  padding: 0.4rem 0.6rem;
  font-size: 1.1rem;
  border-radius: 4px;
}

/* Color Coding Themes for Feeds */
.color-feed-0 { border-left-color: #3b82f6; background-color: rgba(59, 130, 246, 0.22); }
.color-feed-0.all-day { background-color: #3b82f6; color: #ffffff; }

.color-feed-1 { border-left-color: #10b981; background-color: rgba(16, 185, 129, 0.22); }
.color-feed-1.all-day { background-color: #10b981; color: #ffffff; }

.color-feed-2 { border-left-color: #f59e0b; background-color: rgba(245, 158, 11, 0.22); }
.color-feed-2.all-day { background-color: #f59e0b; color: #ffffff; }

.color-feed-3 { border-left-color: #ec4899; background-color: rgba(236, 72, 153, 0.22); }
.color-feed-3.all-day { background-color: #ec4899; color: #ffffff; }

.color-feed-4 { border-left-color: #8b5cf6; background-color: rgba(139, 92, 246, 0.22); }
.color-feed-4.all-day { background-color: #8b5cf6; color: #ffffff; }

/* Default fallback colors */
.color-feed-default { border-left-color: #ef4444; background-color: rgba(239, 68, 68, 0.22); }
.color-feed-default.all-day { background-color: #ef4444; color: #ffffff; }

/* Sleep Mode (Overnight Dim Display) */
.sleep-overlay {
  display: none;
  background-color: #000000;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.sleep-time {
  font-size: 8rem;
  font-weight: 700;
  color: #334155; /* Very dim slate gray */
  opacity: 0.4;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
}

body.sleep-mode .dashboard-wrapper {
  display: none !important;
}

body.sleep-mode .sleep-overlay {
  display: flex !important;
}

/* Sidebar Footer & Settings Button */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid #1f2937;
  flex-shrink: 0;
}

.settings-trigger-btn {
  background: transparent;
  border: 1px solid #374151;
  color: #9ca3af;
  padding: 0.8rem 1.2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.2s ease;
}

.settings-trigger-btn:hover {
  background-color: #1f2937;
  color: #ffffff;
}

/* Settings Modal Backdrop */
.settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.settings-modal.active {
  display: flex;
}

/* Settings Box */
.settings-content {
  width: 780px;
  max-width: 92vw;
  max-height: 85vh;
  background-color: #111827;
  border-radius: 16px;
  border: 1px solid #1f2937;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}

.settings-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
}

.close-settings {
  font-size: 2.2rem;
  font-weight: 400;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
}

.close-settings:hover {
  color: #ffffff;
}

.settings-body {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  flex: 1;
}

.settings-group {
  margin-bottom: 1.8rem;
}

.settings-group label {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #d1d5db;
  margin-bottom: 0.6rem;
}

.settings-group input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid #374151;
  background-color: #1f2937;
  color: #ffffff;
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

.settings-group input[type="text"]:focus {
  border-color: #3b82f6;
}

.settings-help {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #6b7280;
}

/* Calendar Feeds Layout */
.settings-feeds-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.settings-feed-row {
  display: grid;
  grid-template-columns: 140px 1fr 120px 48px;
  gap: 0.6rem;
  align-items: center;
  background-color: #1f2937;
  padding: 0.6rem;
  border-radius: 8px;
}

.settings-feed-row input,
.settings-feed-row select {
  padding: 0.7rem;
  border-radius: 6px;
  border: 1px solid #374151;
  background-color: #111827;
  color: #ffffff;
  font-size: 1rem;
  width: 100%;
  outline: none;
}

.settings-feed-row input:focus,
.settings-feed-row select:focus {
  border-color: #3b82f6;
}

.btn-delete-feed {
  height: 42px;
  width: 42px;
  border-radius: 6px;
  border: none;
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-delete-feed:hover {
  background-color: #ef4444;
  color: #ffffff;
}

.btn-add-feed {
  padding: 0.8rem;
  border-radius: 8px;
  border: 1px dashed #4b5563;
  background-color: transparent;
  color: #60a5fa;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.2s;
}

.btn-add-feed:hover {
  background-color: rgba(96, 165, 250, 0.08);
  border-color: #60a5fa;
}

/* Settings Flex Row */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.settings-row select {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid #374151;
  background-color: #1f2937;
  color: #ffffff;
  font-size: 1.1rem;
  outline: none;
}

.settings-row select:focus {
  border-color: #3b82f6;
}

/* Settings Actions */
.settings-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #1f2937;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  flex-shrink: 0;
}

.btn-save,
.btn-cancel {
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-save {
  background-color: #3b82f6;
  color: #ffffff;
}

.btn-save:hover {
  background-color: #2563eb;
}

.btn-cancel {
  background-color: #374151;
  color: #d1d5db;
}

.btn-cancel:hover {
  background-color: #4b5563;
  color: #ffffff;
}
