/* CSS Custom Properties for Theming */
:root {
  /* Light Theme Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --accent-primary: #3182ce;
  --accent-hover: #2c5aa0;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --error-color: #f56565;
  --conflict-color: #f56565;
  --chat-bg: #ffffff;
  --chat-border: #e2e8f0;
}

[data-theme="dark"] {
  /* Dark Theme Colors */
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --bg-tertiary: #4a5568;
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #a0aec0;
  --accent-primary: #63b3ed;
  --accent-hover: #4299e1;
  --border-color: #4a5568;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --success-color: #68d391;
  --warning-color: #f6ad55;
  --error-color: #fc8181;
  --conflict-color: #fc8181;
  --chat-bg: #2d3748;
  --chat-border: #4a5568;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  height: 100vh;
  overflow: hidden;
}

/* App Container - Phase 6 Layout */
.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}

.brand .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.view-toggle:hover {
  background: var(--bg-tertiary);
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  transform: scale(1.05);
}

/* Main Content Area */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  padding-bottom: 180px; /* Space for chat interface */
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Calendar Section */
.calendar-section {
  margin-bottom: 2rem;
}

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

.calendar-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin: 0;
}

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

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

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

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

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

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

/* Calendar Grid View */
.calendar-grid {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.nav-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--bg-tertiary);
}

#currentPeriod {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.calendar-view {
  min-height: 300px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  padding: 1rem;
}

/* Events List */
.events-list {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 200px;
}

.no-events {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem;
}

.event-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.event-item:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--shadow-color);
}

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

.event-details {
  display: flex;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.event-time, .event-participants {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Conflicts Section */
.conflicts-section {
  background: var(--bg-secondary);
  border: 1px solid var(--conflict-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

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

.section-header h2 {
  color: var(--conflict-color);
  font-size: 1.25rem;
  margin: 0;
}

.conflicts-list {
  space-y: 1rem;
}

.conflict-item {
  background: var(--bg-primary);
  border: 1px solid var(--conflict-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.conflict-title {
  font-weight: 600;
  color: var(--conflict-color);
  margin-bottom: 0.5rem;
}

.conflict-suggestions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.suggestion-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Status Section */
.status-section {
  margin-bottom: 2rem;
}

.status-display {
  display: flex;
  gap: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.5rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.status-value {
  font-weight: 600;
  color: var(--text-primary);
}

.status-online {
  color: var(--success-color);
}

/* Fixed Bottom Chat Interface */
.chat-interface {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--chat-bg);
  border-top: 1px solid var(--chat-border);
  box-shadow: 0 -4px 12px var(--shadow-color);
  z-index: 1000;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 2rem;
  max-height: 200px;
  min-height: 60px;
}

.chat-message {
  margin-bottom: 1rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.chat-message.user-message {
  text-align: right;
}

.chat-message.assistant-message {
  text-align: left;
}

.message-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: inline-block;
  max-width: 80%;
  word-wrap: break-word;
}

.user-message .message-content {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.chat-input-container {
  padding: 1rem 2rem;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-bg);
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
  max-width: 800px;
  margin: 0 auto;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.chat-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.send-btn {
  background: var(--accent-primary);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
}

.send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.send-icon {
  font-size: 1.2rem;
}

.chat-toggle {
  position: absolute;
  top: -50px;
  right: 2rem;
  background: var(--accent-primary);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.chat-toggle:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .main-content {
    padding: 1rem;
    padding-bottom: 180px;
  }
  
  .calendar-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .calendar-controls {
    width: 100%;
    justify-content: center;
  }
  
  .status-display {
    flex-direction: column;
    gap: 1rem;
  }
  
  .chat-input-container {
    padding: 1rem;
  }
  
  .chat-history {
    padding: 1rem;
  }
  
  .message-content {
    max-width: 90%;
  }
  
  .chat-toggle {
    right: 1rem;
  }
}

@media (max-width: 480px) {
  .brand h1 {
    font-size: 1.5rem;
  }
  
  .calendar-controls {
    flex-direction: column;
    width: 100%;
  }
  
  .status-display {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .status-item {
    justify-content: space-between;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --shadow-color: rgba(0, 0, 0, 0.5);
  }
  
  [data-theme="dark"] {
    --border-color: #ffffff;
    --shadow-color: rgba(255, 255, 255, 0.3);
  }
}

/* Focus styles for accessibility */
button:focus,
input:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .chat-interface,
  .theme-toggle,
  .view-toggle {
    display: none;
  }
  
  .main-content {
    padding-bottom: 0;
  }
} 