/* Modern TaskFlow App - Postman-inspired Design */
:root {
  /* Primary Orange Color Palette */
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-300: #fdba74;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --orange-800: #9a3412;
  --orange-900: #7c2d12;

  /* Neutral Colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic Colors */
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;
  
  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;

  /* Theme Variables */
  --primary: var(--orange-500);
  --primary-hover: var(--orange-600);
  --primary-light: var(--orange-50);
  
  --background: #ffffff;
  --surface: #ffffff;
  --surface-secondary: var(--gray-50);
  --surface-hover: var(--gray-100);
  
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-400);
  
  --border: var(--gray-200);
  --border-hover: var(--gray-300);
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html {
  height: 100%;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  font-variation-settings: 'opsz' 32;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--background);
  height: 100%;
  overflow-x: hidden;
}

/* Authentication Page */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--orange-50) 0%, var(--gray-50) 100%);
  padding: 2rem;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  border: 1px solid var(--border);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--orange-600));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow);
}

.brand-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

.auth-content {
  width: 100%;
  overflow: hidden; /* Prevent content from overflowing */
}

.auth-tabs {
  display: flex;
  background: var(--surface-secondary);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s ease;
}

.auth-form[style*="display: none"] {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0; /* Allows flex items to shrink below content size */
  box-sizing: border-box;
}

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-input,
.form-textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: all 0.2s ease;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--orange-100);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  outline: none;
  min-height: 44px;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--danger-500);
  color: white;
  border-color: var(--danger-500);
}

.btn-danger:hover {
  background: var(--danger-600);
  border-color: var(--danger-600);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Error Messages */
.error-message {
  color: var(--danger-500);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
}

.error-message:not(:empty) {
  display: block;
}

/* Field Validation */
.field-error {
  color: var(--danger-500);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  min-height: 1rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.field-error:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

.form-input.invalid {
  border-color: var(--danger-500);
  background-color: var(--danger-50);
}

.form-input.valid {
  border-color: var(--success-500);
}

.password-requirements {
  margin-top: 0.25rem;
}

.password-requirements small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.form-input:focus.invalid {
  border-color: var(--danger-500);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input:focus.valid {
  border-color: var(--success-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* App Page */
.app-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-secondary);
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon-small {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--orange-600));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.brand-text {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.user-greeting {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.greeting-text {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.greeting-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  background: var(--surface-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Main Content */
.app-main {
  flex: 1;
  overflow: hidden;
  padding-bottom: 80px; /* Account for footer height */
}

.main-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.main-panel {
  height: 100%;
  overflow-y: auto;
  background: transparent;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.panel-section {
  background: transparent;
}

.panel-section:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Bottom Footer */
.bottom-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  gap: 1rem;
  width: 100%;
}

.footer-add-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.footer-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-item .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Add Task Form */
.add-task-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Task Tabs */
.task-tabs {
  display: flex;
  gap: 0.5rem;
}

.task-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.task-tab:hover:not(.active) {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.tab-badge {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.task-tab:not(.active) .tab-badge {
  background: var(--surface-secondary);
  color: var(--text-secondary);
}

/* Task List */
.task-list-container {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.task-list {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

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

.task-item.completed {
  opacity: 0.7;
  background: var(--surface-secondary);
}

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

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

.task-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.task-title-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.task-name {
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 1;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  align-self: center;
}

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

.task-actions .btn {
  font-size: 1rem;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  white-space: nowrap;
  min-width: 44px;
  min-height: 44px;
}

.task-actions .btn svg {
  flex-shrink: 0;
}

.complete-task {
  background: var(--orange-500);
  border-color: var(--orange-500);
  color: white;
}

.complete-task:hover {
  background: var(--orange-600);
  border-color: var(--orange-600);
}

.task-item.completed .complete-task {
  background: var(--orange-500);
  border-color: var(--orange-500);
}

.task-item.completed .complete-task:hover {
  background: var(--orange-600);
  border-color: var(--orange-600);
}

.task-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.task-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-tag {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid;
}

.category-tag {
  background: var(--orange-50);
  color: var(--orange-600);
  border-color: var(--orange-200);
}

.due-tag {
  background: var(--gray-100);
  color: var(--gray-600);
  border-color: var(--gray-200);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.375rem 1rem;
  border-radius: var(--radius);
}

.due-tag.urgent {
  background: var(--danger-50);
  color: var(--danger-600);
  border-color: var(--danger-200);
}

.due-tag.soon {
  background: var(--orange-50);
  color: var(--orange-600);
  border-color: var(--orange-200);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  flex: 1;
  min-height: 300px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  background: var(--surface-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.empty-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-content .form-group {
  margin-bottom: 1.25rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  min-height: auto;
  height: auto;
  width: auto;
  font-size: 0.875rem;
  line-height: 1.4;
  z-index: 1100;
  animation: slideInRight 0.3s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.error {
  background: var(--danger-50);
  border-color: var(--danger-200);
  color: var(--danger-600);
}

.toast.success {
  background: var(--success-50);
  border-color: var(--success-200);
  color: var(--success-600);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-page {
    padding: 1rem;
  }
  
  .auth-container {
    padding: 2rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .main-content {
    height: auto;
    min-height: calc(100vh - 150px); /* Account for header and footer height */
  }
  
  .footer-content {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .footer-add-btn {
    justify-content: center;
  }
  
  .footer-stats {
    justify-content: center;
  }
  }
  
  .toast {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
    width: auto;
    height: auto;
    min-height: auto;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    white-space: normal;
    text-overflow: initial;
    overflow: visible;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .task-tabs {
    flex-wrap: wrap;
  }
  
  .header-left {
    gap: 1rem;
  }
  
  .user-greeting {
    display: none;
  }
  
  .modal {
    margin: 1rem;
    max-width: none;
  }
  
  .footer-content {
    padding: 0.75rem 1rem;
  }


@media (max-width: 480px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .main-panel {
    padding: 1rem;
  }
  
  .task-item {
    padding: 0.75rem;
  }
  
  .task-actions {
    flex-direction: column;
    gap: 0.375rem;
  }
  
  .task-actions .btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  .modal-header,
  .modal-content,
  .modal-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .footer-add-btn {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
  }
  
  .stat-item .stat-value {
    font-size: 1rem;
  }
  
  .stat-item .stat-label {
    font-size: 0.7rem;
  }
}
