@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: linear-gradient(135deg, #74ebd5 0%, #9face6 100%);
  padding: 14px;
}

.app-container {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 28px);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(31, 38, 135, 0.12);
}

.app-hidden {
  display: none;
}

.auth-panel {
  width: 100%;
  max-width: 420px;
  margin: auto;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(31, 38, 135, 0.12);
}

.auth-panel h2 {
  margin-bottom: 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.auth-actions .playlist-btn,
.auth-actions .bulk-btn {
  flex: 1;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  color: #1a1a1a;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 600;
}

.date-display {
  font-size: 0.9rem;
  color: #4a4a4a;
  margin-top: 5px;
}

.header-stats {
  background: rgba(255, 255, 255, 0.5);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.75rem;
}

#todo-form {
  background: rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
}

.main-input-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

/* Simplified unified styles at the bottom handle all inputs/selects */

.add-btn {
  background: #1a1a1a;
  color: white;
  border: none;
  width: 45px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.add-btn:hover {
  background: #333;
  transform: scale(1.05);
}

.add-btn:active {
  transform: scale(0.95);
}

.advanced-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 140px;
}

.option-group i {
  color: #64748b;
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
}

.option-group input, .option-group select {
  /* Styles are now inherited from the unified field block below */
}

.playlist-import {
  background: rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.playlist-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.playlist-url-row {
  display: flex;
}

.playlist-attributes-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 0.8fr;
  gap: 10px;
}

/* Simplified unified styles at bottom */

.playlist-btn {
  border: none;
  background: #1a1a1a;
  color: #fff;
  border-radius: 10px;
  padding: 0 16px;
  min-height: 42px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.playlist-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: #444;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  padding: 10px;
}

.select-all-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #333;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
}

.bulk-btn {
  border: none;
  background: #1a1a1a;
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.82rem;
}

.bulk-btn.danger {
  background: #d64545;
}

.bulk-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.task-select {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a1a1a;
  flex-shrink: 0;
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  padding: 10px;
}

/* Simplified unified styles at bottom */

.playlist-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  padding: 6px 15px;
  border-radius: 20px;
  cursor: pointer;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.filter-btn.active, .filter-btn:hover {
  background: rgba(255,255,255,0.8);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

#task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, opacity 0.35s ease;
  animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  border-left: 5px solid transparent;
}

.task-item:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

@media (min-width: 1100px) {
  #todo-form, .playlist-import, .filters, .bulk-actions {
    max-width: 1040px;
  }
}

.task-item.priority-high { border-left-color: #ff6b6b; }
.task-item.priority-medium { border-left-color: #feca57; }
.task-item.priority-low { border-left-color: #48dbfb; }

.task-item.completed {
  opacity: 0.72;
  transform: scale(0.995);
}

.task-item.completed .task-content {
  text-decoration: line-through;
  color: #888;
}

.task-item.selected-for-delete {
  background: rgba(255, 221, 87, 0.25);
  box-shadow: 0 0 0 1px rgba(242, 181, 17, 0.35);
}

.custom-checkbox {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #a0a0a0;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.custom-checkbox:checked {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.custom-checkbox:checked::after {
  content: '✓';
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
}

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

.task-content {
  font-size: 1.05rem;
  color: #1a1a1a;
  font-weight: 500;
  margin-bottom: 5px;
  transition: color 0.3s, text-decoration-color 0.3s;
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  gap: 15px;
  font-size: 0.75rem;
  color: #666;
}

.task-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.playlist-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #e0e7ff;
  font-weight: 600;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #d90429;
  background: rgba(217, 4, 41, 0.09);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.watch-btn:hover {
  background: rgba(217, 4, 41, 0.16);
  transform: translateY(-1px);
}

.delete-btn {
  background: transparent;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  opacity: 0.5;
}

.task-item:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: rgba(255, 107, 107, 0.1);
  transform: scale(1.1);
}

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

@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.9); }
}

.removing {
  animation: fadeOut 0.3s ease forwards;
}

@media (max-width: 768px) {
  body {
    padding: 10px;
    align-items: flex-start;
  }

  .app-container {
    min-height: calc(100vh - 20px);
    padding: 16px;
    border-radius: 20px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-stats {
    width: 100%;
    text-align: center;
  }

  .main-input-wrapper {
    gap: 8px;
  }

  .advanced-options {
    flex-direction: column;
  }

  .option-group {
    width: 100%;
    min-width: 0;
  }

  .filters {
    gap: 8px;
  }

  .playlist-attributes-row {
    grid-template-columns: 1fr;
  }

  #playlist-priority, #playlist-type, #playlist-date {
    width: 100%;
  }

  .playlist-btn {
    height: 40px;
  }

  .bulk-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .select-all-wrap, .bulk-btn {
    width: 100%;
    justify-content: center;
  }

  .filter-btn {
    flex: 1 1 calc(33.333% - 8px);
    text-align: center;
    padding: 8px 10px;
  }

  .task-item {
    padding: 13px;
    gap: 10px;
  }

  .task-meta {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px;
  }

  .app-container {
    min-height: calc(100vh - 16px);
    padding: 12px;
    border-radius: 16px;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .date-display {
    font-size: 0.8rem;
  }

  #todo-form {
    padding: 12px;
  }

  .main-input-wrapper {
    flex-direction: column;
  }

  .add-btn {
    width: 100%;
    height: 42px;
  }

  .playlist-import {
    padding: 10px;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-btn {
    flex: initial;
  }

  .filter-btn:last-child {
    grid-column: span 2;
  }

  .task-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .custom-checkbox {
    align-self: flex-start;
    margin-bottom: 4px;
  }

  .task-details {
    order: 1;
  }

  .task-actions {
    order: 2;
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #e5ecf6;
  }

  .watch-btn {
    flex: 1;
    text-align: center;
    font-size: 0.84rem;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .delete-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    opacity: 1;
    align-self: stretch;
  }
}

body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
  background: radial-gradient(circle at 0% 0%, #e0f2ff 0%, #f5f7ff 40%, #f4f6fb 100%);
  color: #162032;
  padding: 20px;
}

body[data-page="login"] {
  align-items: center;
}

.auth-panel,
.app-container {
  background: #ffffff;
  border: 1px solid #e6ecf7;
  box-shadow: 0 14px 36px rgba(18, 32, 71, 0.08);
}

.auth-panel {
  max-width: 340px;
  width: 100%;
  margin: 0;
  border-radius: 16px;
  padding: 20px;
}

.auth-panel h2 {
  font-size: 1.35rem;
  margin-bottom: 10px;
  color: #101828;
}

.app-container {
  max-width: 1100px;
  min-height: calc(100vh - 40px);
  border-radius: 20px;
  padding: 24px;
}

header h1 {
  font-size: 2rem;
  color: #101828;
}

.date-display {
  color: #64748b;
}

.header-stats { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 14px; color: #334155; }
.session-row { margin-top: 8px; }
.dashboard { display: grid; gap: 14px; margin-bottom: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.stat-card { background: #ffffff; border: 1px solid #e5ecf6; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 0.8rem; color: #475569; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: #0f172a; }
.stat-value.small { font-size: 1.1rem; }
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 999px; transition: width 0.3s ease; }
.progress-label { font-size: 0.9rem; color: #0f172a; font-weight: 600; min-width: 48px; text-align: right; }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chart-card { background: #ffffff; border: 1px solid #e5ecf6; border-radius: 12px; padding: 8px; }
.chart-card h3 { font-size: 0.9rem; margin-bottom: 4px; color: #0f172a; }
.chart-card canvas { height: 96px !important; }

#todo-form,
.playlist-import,
.filters,
.bulk-actions {
  background: #f8fbff;
  border: 1px solid #e3ebf7;
  border-radius: 14px;
  padding: 14px;
}

#task-input,
#task-date,
#task-priority,
#task-category,
#playlist-url,
#playlist-name,
#playlist-priority,
#playlist-type,
#playlist-date,
.auth-form input,
#playlist-filter {
  border: 1px solid #d9e3f0;
  background: #ffffff;
  border-radius: 10px;
  color: #0f172a;
  padding: 10px 12px;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  transition: all 0.2s ease;
  min-width: 140px;
}

#playlist-filter {
  min-width: 180px;
}

#task-input {
  flex: 1;
}

#task-input:focus,
#task-date:focus,
#task-priority:focus,
#task-category:focus,
#playlist-url:focus,
#playlist-name:focus,
#playlist-priority:focus,
#playlist-type:focus,
#playlist-date:focus,
.auth-form input:focus,
#playlist-filter:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  border-color: #93c5fd;
}

.add-btn,
.playlist-btn,
.bulk-btn {
  background: #0f172a;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 600;
}

.add-btn:hover,
.playlist-btn:hover,
.bulk-btn:hover {
  background: #1e293b;
}

.bulk-btn.danger {
  background: #dc2626;
}

.bulk-btn.danger:hover {
  background: #b91c1c;
}

.filter-btn {
  border: 1px solid #d8e2f0;
  background: #ffffff;
  color: #334155;
  border-radius: 999px;
}

.filter-btn.active,
.filter-btn:hover {
  background: #e8f0ff;
  border-color: #c6d8ff;
  color: #1d4ed8;
}

.task-item {
  background: #ffffff;
  border: 1px solid #e5ecf6;
  border-left-width: 5px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.task-item:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.task-item.empty-state {
  justify-content: center;
  text-align: center;
  border-left-color: transparent;
}

.task-content {
  color: #0f172a;
}

.task-meta {
  color: #64748b;
}

.select-all-wrap {
  background: #ffffff;
  border: 1px solid #d8e2f0;
}

.watch-btn {
  background: #fee2e2;
  color: #b91c1c;
}

.watch-btn:hover {
  background: #fecaca;
}

.scroll-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  z-index: 1000;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background: #1e293b;
}

@media (max-width: 980px) {
  body {
    flex-direction: column;
    padding: 12px;
    gap: 14px;
  }

  .auth-panel {
    max-width: none;
  }

  .app-container {
    min-height: auto;
  }
}
