:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --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;
  --border-radius: 8px;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout Components */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

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

.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  gap: 0.5rem;
  white-space: nowrap;
  min-height: 38px;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-300);
}

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

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

.btn-small {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  min-height: 30px;
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 48px;
}

/* Form Components */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.login-card {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card:hover {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  transform: translateY(-2px);
  transition: all 0.3s ease;
}

.login-title {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--gray-800);
  font-size: 1.5rem;
  font-weight: 600;
}

.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--border-radius);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-message {
  color: var(--success);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: var(--border-radius);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0;
}

.card-content {
  padding: 1.5rem;
}

/* Date Selector */
.date-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.date-selector .form-input {
  width: auto;
  min-width: 160px;
}

/* Sync Status */
.sync-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius);
  background: var(--gray-100);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-indicator.online {
  background: var(--success);
}

.status-indicator.offline {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Progress Components */
.progress-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.progress-item {
  background: white;
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.progress-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
  border-radius: 4px;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-align: center;
}

/* Tabs */
.tabs {
  display: flex;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}

.tab-button {
  flex: 1;
  padding: 1rem;
  border: none;
  background: white;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-button:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.tab-button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--gray-50);
}

/* Task Components */
.tasks-container {
  display: grid;
  gap: 1.5rem;
}

.role-section {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.role-header {
  background: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
}

.tasks-grid {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.task-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 1rem;
  background: var(--gray-50);
  transition: box-shadow 0.2s;
}

.task-card:hover {
  box-shadow: var(--shadow);
}

.task-name {
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--gray-800);
  font-size: 0.875rem;
}

.task-assignments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.assignment {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s;
  user-select: none;
}

.checkbox-label:hover {
  background: var(--gray-100);
}

.checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: var(--success);
  cursor: pointer;
}

.member-name {
  font-weight: 500;
  color: var(--gray-700);
}

.assignment.completed .member-name {
  color: var(--success);
}

/* Admin Panel */
.admin-section {
  background: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.admin-section h3 {
  margin-bottom: 1rem;
  color: var(--gray-800);
  font-size: 1.125rem;
}

.checklist-list {
  display: grid;
  gap: 0.5rem;
}

.checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: var(--gray-50);
  transition: background-color 0.2s;
}

.checklist-item:hover {
  background: var(--gray-100);
}

.checklist-info {
  flex: 1;
}

.checklist-title {
  font-weight: 500;
  color: var(--gray-800);
}

.checklist-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Loading States */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  flex-direction: column;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Offline Banner */
.offline-banner {
  background: var(--warning);
  color: white;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--gray-600);
}

.empty-state p {
  font-size: 0.875rem;
}

/* User Info */
.user-info {
  font-size: 0.875rem;
  color: var(--gray-600);
  padding: 0.5rem 0.75rem;
  background: var(--gray-100);
  border-radius: var(--border-radius);
}

/* File Upload */
.file-upload {
  border: 2px dashed var(--gray-300);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  transition: border-color 0.2s;
}

.file-upload:hover {
  border-color: var(--primary);
}

.file-upload.dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-actions {
    justify-content: center;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .date-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .date-selector .form-input {
    width: 100%;
  }
  
  .progress-summary {
    grid-template-columns: 1fr;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab-button {
    border-bottom: none;
    border-right: 3px solid transparent;
  }
  
  .tab-button.active {
    border-right-color: var(--primary);
    border-bottom-color: transparent;
  }
  
  .task-assignments {
    grid-template-columns: 1fr;
  }
  
  .checklist-item {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .login-card {
    margin: 1rem;
  }
}

@media (max-width: 480px) {
  .header-content {
    padding: 0.75rem;
  }
  
  .main-content {
    padding: 0.75rem;
  }
  
  .card-content {
    padding: 1rem;
  }
  
  .task-card {
    padding: 0.75rem;
  }
}

/* Print Styles */
@media print {
  .header,
  .btn,
  .sync-status,
  .offline-banner {
    display: none !important;
  }
  
  .main-content {
    max-width: none;
    padding: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid var(--gray-300);
    page-break-inside: avoid;
  }
  
  .task-card {
    page-break-inside: avoid;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --gray-100: #ffffff;
    --gray-200: #e0e0e0;
    --gray-300: #c0c0c0;
    --gray-800: #000000;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
  
  .form-input {
    border-width: 2px;
  }
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-actions .form-input {
  width: auto;
  min-width: 150px;
}

@media (max-width: 768px) {
  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .card-actions .form-input {
    width: 100%;
  }
}

/* Task Groups */
.task-group {
  margin-bottom: 2rem;
}

.task-group-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--gray-200);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  transition: background-color 0.15s ease-in-out;
}

.task-item:hover {
  background: var(--gray-100);
}

.task-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.task-name {
  font-weight: 600;
  color: var(--gray-800);
}

.task-assignee {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.task-status {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content;
}

.task-status.completed {
  background-color: #dcfce7;
  color: #166534;
}

.task-status.pending {
  background-color: #fef3c7;
  color: #92400e;
}

/* Button Small Variant */
.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
  min-height: 30px;
}

/* Danger Button */
.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn-danger:disabled {
  background-color: var(--gray-400);
  cursor: not-allowed;
}

/* Task Priority Styles */
.priority-low {
  border-left: 4px solid #10b981;
}

.priority-medium {
  border-left: 4px solid #f59e0b;
}

.priority-high {
  border-left: 4px solid #ef4444;
}

.priority-critical {
  border-left: 4px solid #dc2626;
  background-color: #fef2f2;
}

/* Task Card Enhancements */
.task-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 1rem;
  background: white;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.task-card.completed {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.task-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 1rem;
  flex: 1;
}

.task-priority {
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.priority-critical .task-priority {
  background: #fecaca;
  color: #991b1b;
}

.priority-high .task-priority {
  background: #fed7d7;
  color: #c53030;
}

.priority-medium .task-priority {
  background: #fef3c7;
  color: #92400e;
}

.priority-low .task-priority {
  background: #dcfce7;
  color: #166534;
}

.task-description {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
  font-style: italic;
}

.task-details {
  margin-bottom: 1rem;
}

.task-assignment {
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.4;
}

.task-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
  font-weight: 500;
}

.checkbox-label:hover {
  background-color: var(--gray-50);
}

.checkbox-input {
  width: 18px;
  height: 18px;
  accent-color: var(--success);
  cursor: pointer;
}

.task-status-text {
  color: var(--gray-700);
  font-size: 0.875rem;
}

.task-status {
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.task-status.completed {
  background-color: #dcfce7;
  color: #166534;
}

.task-status.pending {
  background-color: #fef3c7;
  color: #92400e;
}

.completion-time {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-200);
}

/* Success notification enhancement */
.notification.success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .task-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .task-priority {
    align-self: flex-end;
  }
  
  .task-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.notification.success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.notification.error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.notification.info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

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

/* Task Item Mobile Layout */
@media (max-width: 768px) {
  .task-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .task-item .btn {
    align-self: flex-end;
  }
}

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

/* Work Sessions Management Styles */
.sessions-header {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.sessions-header h4 {
  margin: 0;
  color: var(--primary);
  font-weight: 600;
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
}

.session-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 1rem;
  background: white;
  transition: all 0.2s ease;
}

.session-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.session-title {
  font-size: 1rem;
  color: var(--gray-800);
}

.session-date {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 500;
  background: var(--gray-50);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.session-details {
  margin-bottom: 1rem;
}

.session-details > div {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.4;
}

.session-details strong {
  color: var(--gray-800);
}

.session-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.btn-danger {
  background-color: #ef4444;
  border-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

/* Card actions styling */
.card-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-actions input[type="date"] {
  width: auto;
  min-width: 150px;
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-20px); }
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .sessions-grid {
    grid-template-columns: 1fr;
  }
  
  .session-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .session-actions {
    justify-content: stretch;
  }
  
  .session-actions .btn {
    flex: 1;
  }
  
  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .card-actions input[type="date"] {
    width: 100%;
  }
}
