/* ===== GLOBAL BRAND COLORS ===== */
:root {
  /* Primary Brand Color */
  --brand-primary: #24528F;
  --brand-primary-hover: #1e4475;
  
  /* Success & Positive Actions */
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-bg: #eef9f0;
  --color-success-text: #135a1f;
  --color-success-border: #c9efcf;
  
  /* Error & Danger Actions */
  --color-error: #dc2626;
  --color-error-hover: #b91c1c;
  --color-error-light: #ef4444;
  --color-error-bg: #fef2f2;
  --color-error-text: #dc2626;
  --color-error-border: #fecaca;
  
  /* Warning & Info */
  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  
  /* Info/Secondary Actions */
  --color-info: #3b82f6;
  --color-info-hover: #2563eb;
  
  /* Background Colors */
  --bg-body: #f7f7f9;
  --bg-white: #fff;
  --bg-light: #f8f9fa;
  --bg-lighter: #fafafa;
  
  /* Text Colors */
  --text-primary: #111;
  --text-secondary: #555;
  --text-tertiary: #666;
  --text-muted: #6b7280;
  
  /* Border Colors */
  --border-light: #ececec;
  --border-medium: #e9ecef;
  --border-strong: #e5e7eb;
  --border-dark: #e0e3e7;
  
  /* Grayscale */
  --gray-100: #f9fafb;
  --gray-200: #f0f2f5;
  --gray-300: #f0f0f0;
  --gray-400: #e0e0e0;
  --gray-500: #ddd;
  --gray-600: #6b7280;
  --gray-700: #4b5563;
  --gray-800: #374151;
  
  /* Edit Mode Colors */
  --edit-mode-border: #fbbf24;
  --edit-mode-bg: #fffbeb;
  
  /* Shadow */
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.15);
  --shadow-lg: 0 6px 20px rgba(0,0,0,0.2);
  --shadow-xl: 0 8px 30px rgba(0,0,0,.06);
}

body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 24px; background: var(--bg-body); color: var(--text-primary); padding-bottom: 100px; }
.container { max-width: 1100px; margin: 0 auto; background: var(--bg-white); padding: 24px; border-radius: 16px; box-shadow: var(--shadow-xl); }
h1 { margin: 0 0 12px; font-size: 28px; cursor: pointer; transition: color 0.2s ease; }
h1:hover { color: var(--brand-primary); }
.subtitle { color: var(--text-secondary); margin-bottom: 20px; }
.notice { 
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 12px 20px; 
  border-radius: 8px; 
  background: var(--color-success-bg); 
  color: var(--color-success-text); 
  border: 1px solid var(--color-success-border); 
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease-out;
  max-width: 400px;
  text-align: left;
}
.notice.error { 
  background: var(--color-error-bg); 
  color: var(--color-error-text); 
  border: 1px solid var(--color-error-border); 
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Mobile responsive notifications */
@media (max-width: 1024px) {
  .notice {
    top: 10px;
    right: 10px;
    left: auto;
    max-width: calc(100vw - 20px);
    transform: none;
    margin: 0;
  }
}
.section { margin: 28px 0; }
.section h2 { 
  font-size: 20px; 
  margin: 0 0 10px; 
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-light);
  border: 1px solid var(--border-medium);
  transition: all 0.2s ease;
}
.section h2:hover {
  background: var(--border-medium);
}
.section-toggle {
  font-size: 16px;
  transition: transform 0.3s ease;
  color: var(--text-tertiary);
}
.section.collapsed .section-toggle {
  transform: rotate(-90deg);
}
.section-content {
  transition: all 0.3s ease;
  overflow: hidden;
}
.section.collapsed .section-content {
  max-height: 0;
  margin: 0;
  opacity: 0;
}
.section.expanded .section-content {
  max-height: 2000px;
  opacity: 1;
}
.section.completed {
  opacity: 0.7;
  text-decoration: line-through;
  transform: scale(0.98);
  transition: all 0.5s ease;
}
.completed-sections {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid var(--border-strong);
}
.completed-sections h2 {
  color: var(--text-muted);
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
  background: var(--gray-100);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
}
.section.moving {
  transition: all 0.8s ease;
  transform: translateY(100px);
  opacity: 0.3;
}
.card { border: 1px solid var(--border-light); border-radius: 12px; padding: 16px; margin-bottom: 12px; background: var(--bg-white); }
.item { display: grid; grid-template-columns: 28px 1fr 280px; gap: 12px; align-items: start; padding: 10px 8px; border-radius: 8px; }
.item:nth-child(odd) { background: var(--bg-lighter); }
.label { line-height: 1.3; }
.notes { width: 100%; max-width: 100%; min-height: 36px; font: inherit; padding: 8px; border: 1px solid var(--gray-500); border-radius: 8px; resize: vertical; }
.notes:invalid { border-color: var(--color-error); box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2); }
.notes:valid { border-color: var(--color-success); }
.actions { display: flex; gap: 10px; margin-top: 14px; }
button, .btn { cursor: pointer; padding: 10px 14px; border-radius: 10px; border: 0; font-weight: 600; }
.btn-primary { background: var(--brand-primary); color: var(--bg-white); }
.btn-secondary { background: var(--gray-200); color: var(--text-primary); border: 1px solid var(--border-dark); }
.meta { color: var(--text-tertiary); font-size: 12px; margin-top: 4px; }

/* Collapsible Admin Menu */
.admin-menu-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1001;
  padding: 20px 28px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  background: linear-gradient(135deg, #10b981, #059669);
  color: var(--bg-white);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-menu-toggle i {
  font-size: 32px;
}
.admin-menu-toggle:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.admin-menu {
  position: fixed;
  bottom: 155px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.admin-menu.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.admin-menu-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  background: var(--brand-primary);
  color: var(--bg-white);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(0px) scale(0.8);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.admin-menu.visible .admin-menu-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.admin-menu-btn:nth-child(1) { transition-delay: 0.05s; }
.admin-menu-btn:nth-child(2) { transition-delay: 0.10s; }
.admin-menu-btn:nth-child(3) { transition-delay: 0.15s; }
.admin-menu-btn:nth-child(4) { transition-delay: 0.20s; }
.admin-menu-btn:nth-child(5) { transition-delay: 0.25s; }
.admin-menu-btn:nth-child(6) { transition-delay: 0.30s; }
.admin-menu-btn:nth-child(7) { transition-delay: 0.35s; }
.admin-menu-btn i {
  font-size: 16px;
}
.admin-menu-btn span {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.admin-menu-btn:hover {
  transform: translateX(-4px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

/* Unique colors for each admin menu button */
#add-section-btn {
  background: linear-gradient(135deg, #10b981, #059669);
}
#add-section-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

#menu-edit-sections {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
#menu-edit-sections:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

#menu-reorder-sections {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
#menu-reorder-sections:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

#menu-import-csv {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}
#menu-import-csv:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
}

#menu-export-csv {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
#menu-export-csv:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

#menu-backup-manager {
  background: linear-gradient(135deg, #ec4899, #db2777);
}
#menu-backup-manager:hover {
  background: linear-gradient(135deg, #db2777, #be185d);
}

#menu-toggle-ids {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
}
#menu-toggle-ids:hover {
  background: linear-gradient(135deg, #0d9488, #0f766e);
}

/* Backup Manager Styles */
.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin: 8px 0;
  background: var(--bg-light);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
}

.backup-info {
  flex: 1;
}

.backup-date {
  font-weight: 600;
  color: var(--text-primary);
}

.backup-filename {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.backup-actions {
  display: flex;
  gap: 8px;
}

.backup-restore-btn {
  padding: 6px 12px;
  background: var(--color-success);
  color: var(--bg-white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s ease;
}

.backup-restore-btn:hover {
  background: var(--color-success-hover);
}

/* ID Display Styles */
.id-display {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: monospace;
  background: var(--gray-300);
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 8px;
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
  border: 1px solid var(--gray-500);
}

.section-id {
  margin-top: 4px;
  display: block;
}

.item-id {
  margin-left: 8px;
  font-size: 9px;
}

.id-display:hover {
  background: var(--gray-400);
  color: var(--text-primary);
}

/* Hide IDs by default */
.id-display {
  display: none;
}

/* Show IDs when show-ids class is active */
.show-ids .id-display {
  display: inline-block;
}

/* Keyboard shortcut text styling with smart contrast */
.shortcut-text {
  font-size: 0.85em;
  font-weight: normal;
  margin-left: 4px;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.1);
  color: #000;
  mix-blend-mode: difference;
}

/* Specific button contrast adjustments */
.btn .shortcut-text {
  background: rgba(0, 0, 0, 0.1);
  color: #000;
  mix-blend-mode: difference;
}

/* Sticky save button shortcut text */
.sticky-save .shortcut-text {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  mix-blend-mode: normal;
  font-size: 0.8em;
}

.admin-menu-btn .shortcut-text {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  mix-blend-mode: normal;
}

.scroll-to-top .shortcut-text {
  background: rgba(0, 0, 0, 0.1);
  color: #000;
  mix-blend-mode: difference;
}

/* Dark button backgrounds - force white text */
.admin-menu-btn .shortcut-text {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  mix-blend-mode: normal;
}

/* Edit mode active state - red background */
.edit-mode #menu-edit-sections {
  background: var(--color-error);
}
.edit-mode #menu-edit-sections:hover {
  background: var(--color-error-hover);
}

/* Reorder mode active state - red background */
.reorder-mode #menu-reorder-sections {
  background: var(--color-error);
}
.reorder-mode #menu-reorder-sections:hover {
  background: var(--color-error-hover);
}

/* Sticky buttons */
.sticky-save {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1002;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 8px;
}
.sticky-save i {
  font-size: 20px;
  margin: 0;
}
.sticky-save span {
  display: none;
}
.sticky-save:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.sticky-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.sticky-save.loading {
  background: var(--gray-600);
}

.scroll-to-top {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  background: var(--brand-primary);
  color: var(--bg-white);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  display: flex;
  align-items: center;
  gap: 8px;
}
.scroll-to-top i {
  font-size: 16px;
}
.scroll-to-top span {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--brand-primary-hover);
}

/* Admin Mode Button */
.admin-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-error);
  color: var(--bg-white);
  border: none;
  cursor: pointer;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.admin-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--color-error-hover);
}
.admin-mode .admin-toggle {
  background: var(--color-success);
}
.admin-mode .admin-toggle:hover {
  background: var(--color-success-hover);
}

/* Admin Menu */

/* Admin Panel for CSV operations */
.admin-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  overflow-y: auto;
}
.admin-panel.visible {
  display: block;
}
.admin-content {
  background: var(--bg-white);
  margin: 20px;
  border-radius: 16px;
  padding: 24px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-strong);
}
.admin-close {
  background: var(--color-error);
  color: var(--bg-white);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

/* Drag and Drop */
.section.dragging {
  opacity: 0.5;
}
.section.drag-over {
  border-top: 3px solid var(--brand-primary);
}
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 16px;
}
.drag-handle:active {
  cursor: grabbing;
}

/* Edit Mode */
.edit-mode .section {
  border: 2px solid var(--edit-mode-border);
  background: var(--edit-mode-bg);
}
.edit-mode .section h2 {
  background: var(--bg-light) !important;
  color: var(--text-primary) !important;
}

/* Drag handle for section reordering */
.section-drag-handle {
  display: none;
  cursor: grab;
  color: var(--text-tertiary);
  font-size: 16px;
  margin-right: 8px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  user-select: none;
}

.reorder-mode .section-drag-handle {
  display: inline-block;
}

.section-drag-handle:hover {
  background: var(--gray-300);
  color: var(--text-primary);
}

.section-drag-handle:active {
  cursor: grabbing;
}

.reorder-mode .section {
  position: relative;
}

.reorder-mode .section.dragging {
  opacity: 0.5;
}

.reorder-mode .section.drag-over {
  border-top: 3px solid var(--color-info);
}

/* Section Action Buttons */
.section-actions {
  display: none;
  gap: 8px;
  margin-left: auto;
}
.edit-mode .section-actions {
  display: flex;
}
.section-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  user-select: none;
}
.section-edit-btn {
  background: var(--color-info);
  color: var(--bg-white) !important;
}
.section-edit-btn:hover {
  background: var(--color-info-hover);
  color: var(--bg-white) !important;
}
.section-delete-btn {
  background: var(--color-error-light);
  color: var(--bg-white) !important;
}
.section-delete-btn:hover {
  background: var(--color-error);
  color: var(--bg-white) !important;
}
.section-add-btn {
  background: var(--color-success);
  color: var(--bg-white) !important;
}
.section-add-btn:hover {
  background: var(--color-success-hover);
  color: var(--bg-white) !important;
}

/* Item Action Buttons */
.item-actions {
  display: none;
  gap: 6px;
  margin-left: auto;
}
.edit-mode .item-actions {
  display: flex;
}
.item-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  user-select: none;
}
.item-delete-btn {
  background: var(--color-error-light);
  color: var(--bg-white) !important;
}
.item-delete-btn:hover {
  background: var(--color-error);
  color: var(--bg-white) !important;
}

/* Table Layout for Items */
.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}
.items-table th,
.items-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
}
.items-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-800);
}
.items-table tr:hover {
  background: var(--gray-100);
}
.item-checkbox {
  width: 40px;
  text-align: center;
}
.item-label {
  min-width: 300px;
}
.item-label-text {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  display: inline-block;
  min-height: 20px;
}
.item-label-text:hover {
  background-color: var(--gray-200);
}
.item-notes {
  min-width: 200px;
}
.item-actions {
  width: 60px;
  text-align: center;
}

/* Inline Edit Input */
.item-edit-input {
  width: 100%;
  padding: 8px;
  border: 2px solid var(--color-info);
  border-radius: 4px;
  font-size: 14px;
  background: var(--bg-white);
}
.item-edit-input:focus {
  outline: none;
  border-color: var(--color-info-hover);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Edit Mode Container */
.item-edit-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.item-edit-save-btn {
  padding: 6px 12px;
  background: var(--color-success);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.item-edit-save-btn:hover {
  background: var(--color-success-hover);
}
.item-edit-cancel-btn {
  padding: 6px 12px;
  background: var(--gray-600);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.item-edit-cancel-btn:hover {
  background: var(--gray-700);
}


/* Mobile Admin Responsive */
@media (max-width: 1024px) {
  body {
    margin: 0;
  }
  .container {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .sticky-save {
    bottom: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }
  .sticky-save i {
    font-size: 18px;
  }
  .admin-menu-toggle {
    bottom: 65px;
    right: 15px;
    padding: 12px 20px;
    font-size: 12px;
    gap: 6px;
  }
  .admin-menu-toggle i {
    font-size: 28px;
  }
  .admin-menu-toggle span {
    font-size: 12px;
  }
  .admin-menu-toggle .shortcut-text {
    display: none;
  }
  .admin-toggle {
    bottom: 65px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  .scroll-to-top {
    bottom: 15px;
    left: 15px;
    padding: 8px 12px;
    gap: 6px;
  }
  .scroll-to-top i {
    font-size: 14px;
  }
  .scroll-to-top span {
    font-size: 12px;
  }
  .scroll-to-top .shortcut-text {
    display: none;
  }
  .admin-content {
    margin: 10px;
    padding: 16px;
  }
  .admin-tabs {
    flex-wrap: wrap;
  }
  .admin-tab {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  /* Mobile Checklist Improvements */
  .items-table {
    display: block;
    overflow-x: auto;
  }
  .items-table th,
  .items-table td {
    padding: 16px 12px;
    font-size: 15px;
  }
  .item-checkbox {
    width: 50px;
    min-width: 50px;
  }
  .item-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
  .item-label {
    min-width: 200px;
    font-size: 15px;
    line-height: 1.5;
  }
  .item-notes {
    min-width: 150px;
    font-size: 14px;
  }
  .item-actions {
    width: 80px;
    min-width: 80px;
    text-align: right;
  }
}
