:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  
  --surface: #FFFFFF;
  --background: #F8FAFC;
  --border: #E2E8F0;
  --border-focus: #93C5FD;
  
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;

  --priority-high-bg: #FEF2F2;
  --priority-high-text: #DC2626;
  --priority-med-bg: #FFFBEB;
  --priority-med-text: #D97706;
  --priority-low-bg: #F0FDF4;
  --priority-low-text: #16A34A;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

/* Auth Buttons */
.auth-wrapper {
  position: relative;
}

.btn-google-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}

.btn-google-login:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  box-shadow: var(--shadow-md);
}

.google-svg {
  flex-shrink: 0;
}

/* User Profile & Dropdown */
.user-profile {
  position: relative;
}

.avatar-button {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 50%;
  outline: none;
  transition: transform 0.15s;
}

.avatar-button:hover {
  transform: scale(1.05);
}

.user-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 268px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 150;
  animation: fadeIn 0.15s ease-out;
}

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

.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
}

.dropdown-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  word-break: break-word;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.dropdown-item {
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: #F1F5F9;
}

.logout-btn {
  color: #DC2626;
}

.logout-btn:hover {
  background: #FEF2F2;
}

/* Main Content */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome Card (Hero State) */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.welcome-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.welcome-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.welcome-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.6;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin-top: 8px;
}

.btn-primary-login {
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}

.btn-primary-login:hover {
  background: #F8FAFC;
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.btn-secondary-login {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.15s;
}

.btn-secondary-login:hover {
  color: var(--primary);
}

/* Tasks App Area */
.tasks-app-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Task Input Bar */
.task-input-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.task-input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.task-input-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px 8px 16px;
  gap: 10px;
}

.input-icon {
  color: var(--text-subtle);
  font-size: 14px;
}

#taskTitleInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  background: transparent;
  min-width: 0;
}

#taskTitleInput::placeholder {
  color: var(--text-subtle);
}

.btn-expand {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-expand:hover, .btn-expand.active {
  background: #F1F5F9;
  color: var(--text-main);
}

.btn-submit {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

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

/* Details Drawer */
.task-details-drawer {
  display: none;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
}

.task-details-drawer.open {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#taskDescInput {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
  background: var(--surface);
}

#taskDescInput:focus {
  border-color: var(--primary);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.detail-field select,
.detail-field input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-main);
  outline: none;
}

/* Controls & Filter Chips */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.chip:hover {
  background: #F1F5F9;
  color: var(--text-main);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.chip-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: #F1F5F9;
  color: var(--text-muted);
}

.chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* Tasks List */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.task-item:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-sm);
}

.task-item.completed {
  background: #F8FAFC;
  opacity: 0.7;
}

.task-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

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

.task-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-word;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-desc-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
  word-break: break-word;
}

.task-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag-cat { background: #F1F5F9; color: var(--text-muted); }
.tag-date { background: #EFF6FF; color: var(--primary); }

.tag-p-high { background: var(--priority-high-bg); color: var(--priority-high-text); font-weight: 500; }
.tag-p-medium { background: var(--priority-med-bg); color: var(--priority-med-text); }
.tag-p-low { background: var(--priority-low-bg); color: var(--priority-low-text); }

.task-delete {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.15s;
  flex-shrink: 0;
}

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

.task-delete:hover {
  background: #FEE2E2;
  color: #DC2626;
}

/* Empty / Loading */
.empty-box, .loading-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
}

.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: auto;
}

@media (max-width: 480px) {
  .app-header {
    padding: 10px 14px;
  }
  .main-content {
    padding: 16px 12px;
  }
  .btn-submit span {
    display: none;
  }
}
