:root {
  --primary: #3498db;
  --secondary: #2c3e50;
  --light: #f8f9fa;
  --dark: #343a40;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  background-color: var(--light);
  color: var(--dark);
  transition: all 0.3s ease;
  padding: 0;
}

body.dark-mode {
  background-color: #121212;
  color: #f1f1f1;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 1.5rem;
}

h1 {
  color: var(--primary);
  margin: 1rem 0;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
}

.action-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  flex: 1 1 100px;
  min-height: 36px;
}

.action-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

#searchInput {
  flex: 2 1 180px;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  min-height: 36px;
}

/* Countdown */
.countdown-container {
  background: rgba(52, 152, 219, 0.1);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
}

.countdown-timer {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.countdown-item {
  background: var(--primary);
  color: white;
  padding: 0.5rem;
  border-radius: 0.25rem;
  min-width: 60px;
  text-align: center;
}

.countdown-item span:first-child {
  font-size: 1.25rem;
  font-weight: bold;
  display: block;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  background-color: var(--primary);
  color: white;
  position: sticky;
  top: 0;
}

tr:hover {
  background-color: rgba(52, 152, 219, 0.05);
}

/* Subject Categories */
.subject-bangla { border-left: 4px solid #e74c3c; }
.subject-english { border-left: 4px solid #3498db; }
.subject-math { border-left: 4px solid #2ecc71; }
.subject-science { border-left: 4px solid #9b59b6; }

/* Days Left Indicators */
.days-left {
  font-weight: bold;
}

.completed {
  color: var(--danger);
  opacity: 0.7;
}

.today {
  color: var(--success);
  font-weight: bold;
}

.upcoming {
  color: var(--warning);
}

/* Notification */
.notification {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background-color: var(--primary);
  color: white;
  padding: 1rem;
  border-radius: 0.25rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  display: none;
  z-index: 1000;
  max-width: 300px;
}

/* Print Styles */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding: 0.5cm;
    margin: 0;
    box-shadow: none;
  }

  .controls, .countdown-container, .notification {
    display: none !important;
  }

  table {
    width: 100% !important;
    font-size: 10pt !important;
    page-break-inside: avoid;
  }

  th {
    background-color: var(--primary) !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
}

/* Mobile Breakpoints */
@media (max-width: 768px) {
  .controls {
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
  }

  .action-btn {
    flex: 1 1 80px;
    font-size: 0.8rem;
    padding: 0.4rem;
  }

  #searchInput {
    flex: 2 1 120px;
    font-size: 0.8rem;
    padding: 0.4rem;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.3rem;
  }
}

@media (max-width: 480px) {
  .controls {
    flex-direction: column;
  }

  .action-btn, #searchInput {
    width: 100%;
    flex: 1 1 auto;
  }

  .countdown-item {
    min-width: 50px;
    padding: 0.3rem;
  }

  .countdown-item span:first-child {
    font-size: 1rem;
  }
}