/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --accent:     #1E3A5F;   /* overridden by config.js */
  --bg:         #F3F4F6;
  --card:       #FFFFFF;
  --text:       #111827;
  --text-muted: #6B7280;
  --border:     #E5E7EB;
  --red:        #DC2626;
  --yellow:     #D97706;
  --green:      #059669;
  --radius:     10px;
  --shadow:     0 1px 4px rgba(0,0,0,0.07);
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg:         #0F172A;
  --card:       #1E293B;
  --text:       #F1F5F9;
  --text-muted: #94A3B8;
  --border:     #334155;
  --shadow:     0 1px 4px rgba(0,0,0,0.3);
}

[data-theme="dark"] header {
  background: #FFFFFF;
  border-bottom-color: #E5E7EB;
}

[data-theme="dark"] header .header-greeting,
[data-theme="dark"] header .header-date {
  color: #111827;
}

[data-theme="dark"] header .status-badge.status-ok   { background: #D1FAE5; color: #065F46; }
[data-theme="dark"] header .status-badge.status-warn  { background: #FEF3C7; color: #92400E; }
[data-theme="dark"] header .status-badge.status-alert { background: #FEE2E2; color: #991B1B; }

[data-theme="dark"] header .sign-out-btn {
  background: none;
  border-color: #E5E7EB;
  color: #6B7280;
}

[data-theme="dark"] header .sign-out-btn:hover { background: #F9FAFB; }

[data-theme="dark"] header .theme-btn {
  background: none;
  border-color: #E5E7EB;
  color: #6B7280;
}

[data-theme="dark"] header .theme-btn svg { color: #6B7280; }
[data-theme="dark"] header .theme-btn:hover { background: #F3F4F6; }

[data-theme="dark"] .google-btn {
  background: #1E293B;
  color: #F1F5F9;
  border-color: #334155;
}

[data-theme="dark"] .google-btn:hover {
  background: #273549;
}

[data-theme="dark"] .sign-out-btn:hover,
[data-theme="dark"] .btn-cancel:hover {
  background: #273549;
}

[data-theme="dark"] .form-group input {
  background: #0F172A;
  color: #F1F5F9;
  border-color: #334155;
}

[data-theme="dark"] .folder-tile {
  background: #1E293B;
}

[data-theme="dark"] .folder-tile:hover {
  background: #273549;
}

[data-theme="dark"] .setup-notice {
  background: #1e3a5f;
  border-color: #1d4ed8;
  color: #93c5fd;
}

[data-theme="dark"] .modal {
  background: #1E293B;
}

[data-theme="dark"] .btn-cancel {
  background: #1E293B;
  color: #F1F5F9;
  border-color: #334155;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
/* Loading screen */
#loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

/* Logo in login */
.login-logo-img {
  width: 220px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  margin-bottom: 20px;
}

.login-initials {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

/* Google sign-in button */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.google-btn:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}

/* ============================================================
   TOP STRIPE
   ============================================================ */
#top-stripe {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #60a5fa, var(--accent));
  background-size: 200% 100%;
  z-index: 200;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
  background: var(--accent);
  border-bottom: none;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 4px;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Logo in header */
.header-logo-img {
  width: 148px;
  height: auto;
  max-height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  background: white;
  padding: 3px 4px;
  border-radius: 7px;
}

.header-initials {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-greeting {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.header-date {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Status badge */
.status-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status-ok     { background: #D1FAE5; color: #065F46; }
.status-warn   { background: #FEF3C7; color: #92400E; }
.status-alert  { background: #FEE2E2; color: #991B1B; }

.sign-out-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #ffffff;
  transition: background 0.15s;
}

.sign-out-btn:hover { background: rgba(255,255,255,0.25); }

/* Theme toggle button */
.theme-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.theme-btn:hover { background: rgba(255,255,255,0.25); }
.theme-btn svg { color: #ffffff; }

/* Setup notice */
.setup-notice {
  background: #EFF6FF;
  border-bottom: 1px solid #BFDBFE;
  padding: 12px 32px;
  font-size: 13px;
  color: #1D4ED8;
  text-align: center;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 100px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border-left: 4px solid var(--accent);
}

.card-full {
  grid-column: 1 / -1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-header h2,
.card > h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}

.card > h2 {
  margin-bottom: 18px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.88; }

/* ============================================================
   SCHEDULE LIST
   ============================================================ */
.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.schedule-item:first-child { padding-top: 0; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-green  { background: var(--green); }
.dot-gray   { background: #D1D5DB; }

.event-time {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 64px;
  flex-shrink: 0;
}

.event-title {
  font-size: 14px;
  font-weight: 500;
}

/* ============================================================
   DEADLINES LIST
   ============================================================ */
.deadline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.deadline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.deadline-item:first-child { padding-top: 0; }

.deadline-title {
  font-size: 14px;
  font-weight: 500;
}

.deadline-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.deadline-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-green  { background: #D1FAE5; color: #065F46; }

/* ============================================================
   DRIVE FOLDERS
   ============================================================ */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.folder-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 8px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.folder-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

/* Individual folder colors */
.folder-tile:nth-child(1) { background: #EFF6FF; }
.folder-tile:nth-child(1) svg { color: #2563EB; }

.folder-tile:nth-child(2) { background: #F0FDF4; }
.folder-tile:nth-child(2) svg { color: #16A34A; }

.folder-tile:nth-child(3) { background: #FFF7ED; }
.folder-tile:nth-child(3) svg { color: #EA580C; }

.folder-tile:nth-child(4) { background: #FDF4FF; }
.folder-tile:nth-child(4) svg { color: #9333EA; }

.folder-tile:nth-child(5) { background: #FFFBEB; }
.folder-tile:nth-child(5) svg { color: #D97706; }

.folder-tile:nth-child(6) { background: #F0F9FF; }
.folder-tile:nth-child(6) svg { color: #0284C7; }

/* Dark mode folder colors */
[data-theme="dark"] .folder-tile:nth-child(1) { background: #1e3a6e; }
[data-theme="dark"] .folder-tile:nth-child(2) { background: #14401f; }
[data-theme="dark"] .folder-tile:nth-child(3) { background: #43200a; }
[data-theme="dark"] .folder-tile:nth-child(4) { background: #3b1054; }
[data-theme="dark"] .folder-tile:nth-child(5) { background: #3d2c00; }
[data-theme="dark"] .folder-tile:nth-child(6) { background: #0c3148; }

.folder-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

/* ============================================================
   QUICK ACTIONS BAR
   ============================================================ */
.quick-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
  z-index: 20;
}

.quick-actions button,
.quick-actions a {
  padding: 11px 32px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: opacity 0.15s;
}

.quick-actions button {
  background: var(--accent);
  color: white;
}

.quick-actions a {
  background: #374151;
  color: white;
}

.quick-actions button:hover,
.quick-actions a:hover { opacity: 0.85; }

/* ============================================================
   MODAL
   ============================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  background: var(--card);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.modal h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.label-optional {
  font-weight: 400;
  color: #9CA3AF;
}

.form-group input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  background: white;
}

.form-group input:focus {
  border-color: var(--accent);
}

.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.form-group select:focus { border-color: var(--accent); }

/* Unified time picker */
.time-picker-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--card);
  transition: border-color 0.15s;
}

.time-picker-wrap:focus-within { border-color: var(--accent); }

.time-picker-wrap select {
  width: auto !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  padding: 10px 8px 10px 13px;
  flex: 1;
}

.time-picker-wrap select:focus { border-color: transparent !important; box-shadow: none; }

.time-picker-wrap select + select {
  flex: 0 0 80px !important;
  padding-left: 10px;
  border-left: 1.5px solid var(--border) !important;
}

.time-colon {
  font-size: 15px;
  color: var(--text-muted);
  padding: 0 2px;
  display: none; /* hidden — border acts as separator */
}

.save-error {
  font-size: 13px;
  color: var(--red);
  min-height: 18px;
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-cancel {
  flex: 1;
  padding: 11px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}

.btn-save {
  flex: 2;
  padding: 11px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-save:hover   { opacity: 0.9; }
.btn-cancel:hover { background: #F9FAFB; }

.btn-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================================
   UTILITY
   ============================================================ */
.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

.loading-state {
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

.error-state {
  color: var(--red);
  font-size: 13px;
  padding: 12px 0;
  text-align: center;
}

.item-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.action-btn {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.action-btn:hover { background: var(--border); color: var(--text); }
.action-btn.delete-btn:hover { background: #FEE2E2; color: var(--red); }

.demo-notice {
  font-size: 12px;
  color: #9CA3AF;
  font-style: italic;
  padding: 8px 0 0;
  text-align: center;
}
