/* Responsive Design */

/* Tablet and below */
@media (max-width: 768px) {
  /* Layout adjustments */
  .app-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Sidebar becomes top section */
  .sidebar {
    order: -1;
    grid-column: 1;
  }

  /* Main content takes full width */
  .main-content {
    grid-column: 1;
  }

  /* Timer section */
  .timer-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .timer-display {
    order: 1;
  }

  .timer-controls {
    order: 2;
  }

  /* Projects section */
  .projects-section {
    grid-template-columns: 1fr;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Gamification */
  .gamification {
    flex-direction: column;
    gap: 1.5rem;
  }

  .streak-pills {
    justify-content: center;
  }

  .achievements {
    grid-template-columns: repeat(2, 1fr);
  }

  /* History filters */
  .history-filters {
    flex-direction: column;
  }

  .history-filters .filter-group {
    width: 100%;
  }

  .history-filters select {
    width: 100%;
  }

  /* History items */
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .history-project {
    width: 100%;
  }

  /* Chart controls */
  .chart-controls {
    justify-content: center;
  }

  .chart-container {
    height: 250px;
  }

  /* Settings modal */
  .settings-content {
    width: 90%;
    max-width: 400px;
  }

  /* Theme options */
  .theme-options {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Accent colors */
  .accent-colors {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Typography adjustments */
  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  /* Button sizes */
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Input sizes */
  input[type="text"],
  select {
    padding: 0.75rem;
    font-size: 0.9rem;
  }
}

/* Mobile and below */
@media (max-width: 480px) {
  /* App container */
  .app-container {
    padding: 1rem;
    gap: 1rem;
  }

  /* Timer display */
  .timer-display {
    padding: 1.5rem;
  }

  .timer-time {
    font-size: 2.5rem;
  }

  /* Timer controls */
  .timer-controls {
    flex-direction: column;
    gap: 0.75rem;
  }

  .timer-controls .btn {
    width: 100%;
  }

  /* Project selector */
  .project-selector {
    width: 100%;
  }

  /* Stats grid - single column */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Stat boxes */
  .stat-box {
    padding: 1rem;
  }

  /* Achievements - single column */
  .achievements {
    grid-template-columns: 1fr;
  }

  /* History items */
  .history-item {
    padding: 0.75rem 1rem;
  }

  /* Chart container */
  .chart-container {
    height: 200px;
    padding: 0.5rem;
  }

  /* Cards */
  .card {
    padding: 1rem;
  }

  /* Typography */
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  /* Buttons */
  .btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
  }

  /* Inputs */
  input[type="text"],
  select {
    font-size: 0.85rem;
  }

  /* Gamification avatar */
  .avatar {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  /* Streak pills */
  .streak-pill {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .chart-container {
    height: 180px;
  }

  .timer-time {
    font-size: 2rem;
  }
}

/* Large screens */
@media (min-width: 1200px) {
  .app-container {
    max-width: 1400px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .achievements {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .chart-container {
    height: 350px;
  }
}

/* Print styles */
@media print {
  .theme-toggle,
  .settings-btn,
  .btn-start,
  .btn-stop,
  .btn-delete,
  .btn-archive,
  .btn-add-project,
  .btn-export,
  .btn-import,
  .btn-reset {
    display: none;
  }

  .app-container {
    display: block;
  }

  .sidebar {
    display: none;
  }

  body {
    background-color: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: #ffffff;
    --text-secondary: #cccccc;
  }

  .btn {
    border-width: 2px;
  }

  input[type="text"],
  select {
    border-width: 2px;
  }
}

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

  .progress-fill::after {
    animation: none;
  }

  .avatar {
    animation: none;
  }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
  /* Already dark by default, no changes needed */
}

/* Light mode preference */
@media (prefers-color-scheme: light) {
  /* Optional: auto-switch to a light theme if user prefers */
  /* For now, we keep dark mode as default for the timer app */
}