/* DTF App Styles */

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

:root {
  --sidebar-width: 260px;
  --header-height: 60px;
  --primary-color: #667eea;
  --primary-dark: #5a67d8;
  --bg-color: #f5f7fb;
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #252542;
  --sidebar-active: #667eea;
  --text-light: #a0aec0;
  --text-dark: #1a1a2e;
  
  /* Light mode colors */
  --content-bg: white;
  --content-text: #1f2937;
  --content-text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --hover-bg: #f9fafb;
  --input-bg: white;
  --input-border: #d1d5db;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --modal-overlay: rgba(0, 0, 0, 0.5);
}

/* Dark mode */
[data-theme="dark"] {
  --bg-color: #0f0f1a;
  --sidebar-bg: #0a0a14;
  --sidebar-hover: #1a1a2e;
  --content-bg: #1a1a2e;
  --content-text: #e5e7eb;
  --content-text-secondary: #9ca3af;
  --border-color: #374151;
  --hover-bg: #252542;
  --input-bg: #252542;
  --input-border: #4b5563;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --modal-overlay: rgba(0, 0, 0, 0.7);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-color);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Page Containers */
.page {
  display: none;
  width: 100%;
  min-height: 100vh;
}

.page.active {
  display: block;
}

#login-page.active,
#loading-page.active {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Container */
.container {
  background: var(--content-bg);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.container h1 {
  color: var(--content-text);
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.subtitle {
  color: var(--content-text-secondary);
  margin-bottom: 2rem;
}

/* Google Sign-In Button */
.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.google-btn img {
  width: 20px;
  height: 20px;
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
}

/* Logo Styles */
.logo-link {
  display: block;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logo-link:hover {
  opacity: 0.9;
}

.logo {
  height: 36px;
  width: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

/* Category Sections */
.nav-category {
  margin-bottom: 0.25rem;
}

.nav-category-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: var(--text-light);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0;
}

.nav-category-header:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.nav-category-header .category-icon {
  margin-right: 0.5rem;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.nav-category-header .category-arrow {
  margin-left: auto;
  transition: transform 0.25s ease;
  font-size: 0.75rem;
}

.nav-category.collapsed .category-arrow {
  transform: rotate(-90deg);
}

/* Smooth accordion animation */
.nav-items {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
}

.nav-category.collapsed .nav-items {
  max-height: 0;
  opacity: 0;
}

/* Nav Items with animations */
.nav-item {
  display: flex;
  align-items: center;
  padding: 0.625rem 1.5rem 0.625rem 2.5rem;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
  padding-left: 2.75rem;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: white;
}

/* Active indicator line */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: white;
  border-radius: 0 2px 2px 0;
  animation: activeIndicator 0.2s ease;
}

@keyframes activeIndicator {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.nav-item .nav-icon {
  margin-right: 0.75rem;
  font-size: 1rem;
  width: 20px;
  text-align: center;
  transition: transform 0.15s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.1);
}

/* Nav item badge for counts */
.nav-item .nav-badge {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.3);
}

/* Badge variants */
.nav-badge.badge-warning {
  background: #f59e0b;
  color: white;
}

.nav-badge.badge-danger {
  background: #ef4444;
  color: white;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Presence wrapper for avatars + edit button */
.presence-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

/* Edit profile button */
.edit-profile-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.edit-profile-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

#user-name {
  color: white;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 100%;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-header {
  background: var(--content-bg);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--card-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.content-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--content-text);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--content-text);
}

.content-body {
  flex: 1;
  padding: 2rem;
  width: 100%;
}

.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: fadeSlideIn 0.25s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .content-body {
    padding: 1rem;
  }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

/* ========================================
   PAGE SETTINGS MENU
   ======================================== */

/* Nav item settings button */
.nav-item-settings {
  padding: 0.25rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  font-size: 0.875rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Show settings button on hover - works for both old (child) and new (sibling) structure */
.nav-item:hover .nav-item-settings,
.nav-item-wrapper:hover .nav-item-settings,
.nav-item .nav-item-settings.active,
.nav-item-wrapper .nav-item-settings.active {
  opacity: 1;
}

.nav-item-settings:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item-settings.active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
}

/* Page Settings Menu */
.page-settings-menu {
  position: fixed;
  background: var(--content-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  min-width: 200px;
  z-index: 2000;
  animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.page-settings-menu-header {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--content-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.page-settings-menu-section {
  padding: 0.75rem;
}

.page-settings-menu-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--content-text-secondary);
  margin-bottom: 0.5rem;
}

.page-settings-view-options {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-settings-view-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--content-text);
  font-size: 0.875rem;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.page-settings-view-option:hover {
  background: var(--hover-bg);
}

.page-settings-view-option.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.page-settings-view-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.page-settings-view-label {
  flex: 1;
}

/* Page Settings Menu Header with Reset */
.page-settings-menu-header {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--content-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-settings-reset-btn {
  background: none;
  border: none;
  color: var(--content-text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.page-settings-reset-btn:hover {
  background: var(--hover-bg);
  color: var(--danger-color, #ef4444);
}

/* Page Size Options */
.page-settings-page-size {
  display: flex;
  gap: 0.25rem;
}

.page-settings-size-option {
  padding: 0.375rem 0.75rem;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--content-text);
  transition: all 0.15s ease;
}

.page-settings-size-option:hover {
  border-color: var(--primary-color);
}

.page-settings-size-option.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Sort Options */
.page-settings-sort {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.page-settings-sort-column {
  flex: 1;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--content-bg);
  color: var(--content-text);
  font-size: 0.8125rem;
}

.page-settings-sort-dir {
  padding: 0.375rem 0.5rem;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--content-text);
  transition: all 0.15s ease;
  min-width: 32px;
}

.page-settings-sort-dir:hover {
  border-color: var(--primary-color);
}

.page-settings-sort-dir.desc {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Info section */
.page-settings-info {
  font-size: 0.75rem;
  color: var(--content-text-secondary);
  line-height: 1.4;
}

.page-settings-show-all-cols {
  display: block;
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
}

.page-settings-show-all-cols:hover {
  text-decoration: underline;
}

/* Badge */
.page-settings-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--primary-color);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9px;
  margin-left: 0.25rem;
}

/* Save Filters Section */
.page-settings-save-filters {
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.page-settings-save-filters-btn,
.page-settings-clear-filters-btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: all 0.15s ease;
}

.page-settings-save-filters-btn {
  background: var(--primary-color);
  color: white;
  border: none;
}

.page-settings-save-filters-btn:hover {
  opacity: 0.9;
}

.page-settings-clear-filters-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--content-text-secondary);
}

.page-settings-clear-filters-btn:hover {
  border-color: var(--danger-color, #ef4444);
  color: var(--danger-color, #ef4444);
}

/* Mobile: Position menu below the sidebar */
@media (max-width: 1024px) {
  .page-settings-menu {
    left: 50% !important;
    transform: translateX(-50%);
    top: auto !important;
    bottom: 100px;
    max-width: 90vw;
  }
}
