/* Toby's Command Hub - Main Styles */

/* Base Variables - Dark Theme (Default) */
:root {
  --bg-primary: #1C2526;
  --bg-secondary: #2A3335;
  --bg-tertiary: #3A4445;
  --text-primary: #D3D8E0;
  --text-secondary: #A8B2BA;
  --text-muted: #7A8892;
  --accent-primary: #4A9EFF;
  --accent-secondary: #2D7DD2;
  --border-color: #404B4D;
  --shadow: rgba(0, 0, 0, 0.3);
  --status-green: #22C55E;
  --status-orange: #F59E0B;
  --status-red: #EF4444;
  --tile-bg: var(--bg-secondary);
  --tile-hover: var(--bg-tertiary);
}

/* Light Theme */
.theme-light {
  --bg-primary: #4A4033;
  --bg-secondary: #5A5043;
  --bg-tertiary: #6A6053;
  --text-primary: #D3C0A7;
  --text-secondary: #C3B097;
  --text-muted: #B3A087;
  --accent-primary: #8B7355;
  --accent-secondary: #7B6345;
  --border-color: #6A6053;
  --shadow: rgba(74, 64, 51, 0.3);
  --tile-bg: var(--bg-secondary);
  --tile-hover: var(--bg-tertiary);
}

/* Manpage Theme */
.theme-manpage {
  --bg-primary: #3A352D;
  --bg-secondary: #4A453D;
  --bg-tertiary: #5A554D;
  --text-primary: #E8E2D9;
  --text-secondary: #D8D2C9;
  --text-muted: #C8C2B9;
  --accent-primary: #A0956B;
  --accent-secondary: #90855B;
  --border-color: #5A554D;
  --shadow: rgba(58, 53, 45, 0.3);
  --tile-bg: var(--bg-secondary);
  --tile-hover: var(--bg-tertiary);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  transition: all 0.3s ease;
}

/* App Container */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hub-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hub-title i {
  color: var(--accent-primary);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: none;
}

.sidebar-toggle:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

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

.nav-item {
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

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

.nav-item i {
  width: 1.2rem;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.theme-toggle {
  margin-bottom: 1rem;
}

.theme-toggle label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.theme-toggle select {
  width: 100%;
  padding: 0.5rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
  font-size: 0.8rem;
}

.customize-btn {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--accent-secondary);
  border: none;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.customize-btn:hover {
  background-color: var(--accent-primary);
}

.customize-btn.active {
  background-color: var(--status-orange);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

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

.section-header h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.customize-controls {
  display: flex;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-secondary);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
}

/* Dashboard Grid - Brad Woods Digital Garden Inspired */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Dashboard Tiles */
.dashboard-tile {
  background-color: var(--tile-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 150px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-tile:hover {
  background-color: var(--tile-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.tile-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tile-title i {
  color: var(--accent-primary);
  font-size: 1rem;
}

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

.status-dot.green {
  background-color: var(--status-green);
  box-shadow: 0 0 6px var(--status-green);
}

.status-dot.orange {
  background-color: var(--status-orange);
  box-shadow: 0 0 6px var(--status-orange);
}

.status-dot.red {
  background-color: var(--status-red);
  box-shadow: 0 0 6px var(--status-red);
}

.tile-content {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.tile-edit-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: none;
  gap: 0.25rem;
}

.tile-edit-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.2s ease;
}

.tile-edit-btn:hover {
  background-color: var(--accent-primary);
  color: white;
}

.dashboard-tile.editing .tile-edit-controls {
  display: flex;
}

.dashboard-tile.editing {
  border-color: var(--accent-primary);
}

/* Search Box */
.search-box {
  position: relative;
  max-width: 300px;
  margin-bottom: 1.5rem;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Chat List */
.chat-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.chat-item {
  background-color: var(--tile-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-item:hover {
  background-color: var(--tile-hover);
  transform: translateY(-1px);
}

.chat-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.chat-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.chat-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Bookmark Categories */
.bookmark-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.bookmark-category {
  background-color: var(--tile-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-title i {
  color: var(--accent-primary);
}

.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.bookmark-item:hover {
  background-color: var(--bg-tertiary);
}

.bookmark-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.bookmark-details {
  flex: 1;
  min-width: 0;
}

.bookmark-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

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

.modal {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

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

.modal-body h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.project-overview p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.project-notes textarea {
  width: 100%;
  height: 100px;
  padding: 0.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.9rem;
}

.project-notes textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    transform: translateX(-100%);
    position: fixed;
    z-index: 200;
    height: 100vh;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .main-content {
    padding: 1rem;
    width: 100%;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .dashboard-tile {
    min-height: 120px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .bookmark-categories {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .chat-list {
    grid-template-columns: 1fr;
  }
  
  .modal {
    width: 95%;
    max-height: 90vh;
    margin: 1rem;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  /* Mobile nav overlay */
  .sidebar.open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 0.75rem;
  }
  
  .dashboard-tile {
    padding: 0.75rem;
    min-height: 100px;
  }
  
  .tile-title {
    font-size: 0.85rem;
  }
  
  .tile-content {
    font-size: 0.75rem;
  }
  
  .section-header h2 {
    font-size: 1.5rem;
  }
}