/* style.css — extended with new improvements */
:root {
  --primary: #6366f1;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --dark: #1e293b;
}

/* Base styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Toggle switch styling */
.toggle-bg {
  transition: background-color 0.3s ease;
  height: 1.5rem;
  width: 3rem;
  position: relative;
  cursor: pointer;
}

.toggle-bg:after {
  content: '';
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  background: white;
  border-radius: 9999px;
  height: 1.25rem;
  width: 1.25rem;
  transition: transform 0.3s ease;
}

#settingsToggle:checked + .toggle-bg:after {
  transform: translateX(1.5rem);
}

#settingsToggle:checked + .toggle-bg {
  background-color: var(--primary);
}

/* Progress bar colors */
.bg-indigo-500 { background-color: #6366f1; }
.bg-purple-500 { background-color: #8b5cf6; }

/* Animation for expanding sections */
.subject-content, .topic-tabs {
  transition: max-height 0.3s ease-out, opacity 0.3s ease;
}

/* Button hover effects */
button {
  transition: transform 0.2s, opacity 0.2s;
}

button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* Input focus styles */
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Card hover effects */
.bg-white {
  transition: box-shadow 0.3s, transform 0.3s;
}

.bg-white:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

/* Reduced gap for topics */
#subjectsContainer .space-y-1 > * {
  margin-bottom: 0.25rem;
}

/* Tab styling */
.tab-buttons button {
  transition: all 0.3s ease;
}

.tab-buttons button.active {
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
}

/* Chat Container */
#chatContainer {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background-color: #f9fafb;
  border-radius: 8px;
}

.chat-message.user-message {
  align-self: flex-end;
}

.chat-message.ai-message {
  align-self: flex-start;
}

.chat-message .bg-indigo-100,
.chat-message .bg-green-100 {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

#chatInput:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
  border-color: #10b981;
}

/* Notification styles */
.notification {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 50;
  animation: fadeIn 0.3s, fadeOut 0.5s 2.5s;
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .flex-col-mobile {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .gap-2-mobile > * {
    margin-bottom: 0.5rem;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }
  
  .subject-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .timeline-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  #chatContainer {
    max-height: 250px;
  }
}

/* Edit controls */
.edit-control.hidden {
  display: none !important;
}

/* New responsive additions */
@media (max-width: 640px) {
  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  #dateControls {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
  }
  
  #dateControls > div {
    width: 100%;
  }
  
  #dateControls input {
    width: 100%;
  }
}

/* Note container improvements */
.notes-container textarea {
  min-height: 100px;
  resize: vertical;
}

/* Subject cards on mobile */
@media (max-width: 768px) {
  .subject-card {
    padding: 1rem;
  }
  
  .subject-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .topic-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .topic-actions {
    align-self: flex-end;
    margin-top: 10px;
  }
}