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

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

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

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

/* Header */
.header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
}

.version-info {
  display: flex;
  align-items: center;
}

.version-badge {
  background: var(--secondary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

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

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

.btn-icon {
  width: 1rem;
  height: 1rem;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background: #475569;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

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

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

/* Main Content */
.main {
  min-height: calc(100vh - 80px);
  padding: 2rem 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 500px;
  margin: 0 auto;
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.empty-state h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Timeline List */
.timeline-list {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.timeline-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.timeline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.timeline-order {
  background: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-right: 0.75rem;
  min-width: 2rem;
  text-align: center;
}

.timeline-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.timeline-card-actions {
  display: flex;
  gap: 0.5rem;
}

.timeline-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.timeline-card-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-icon {
  width: 1rem;
  height: 1rem;
}

/* Timeline View */
.timeline-view {
  max-width: 800px;
  margin: 0 auto;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.timeline-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Task Tree */
.task-tree {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-item {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.task-item.completed {
  opacity: 0.6;
  background: #f8fafc;
  border-left: 4px solid var(--success-color);
  position: relative;
}

.task-item.completed::after {
  content: "COMPLETADA";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--success-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.task-item.completed .task-priority {
  opacity: 0.5;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.task-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.task-checkbox.checked {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.task-order {
  background: var(--secondary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-right: 0.5rem;
  min-width: 1.5rem;
  text-align: center;
}

.task-priority {
  font-size: 1rem;
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
}

.task-title {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.task-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-left: 2rem;
  margin-bottom: 0.5rem;
}

.task-meta {
  display: flex;
  gap: 1rem;
  margin-left: 2rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.task-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

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

.task-status.in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.task-status.completed {
  background: #d1fae5;
  color: #065f46;
}

/* Subtasks */
.subtasks {
  margin-left: 2rem;
  margin-top: 0.5rem;
  border-left: 2px solid var(--border-color);
  padding-left: 1rem;
}

.subtask-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.subtask-item:hover {
  background: #f1f5f9;
  box-shadow: var(--shadow-sm);
}

.subtask-item.completed {
  opacity: 0.6;
  background: #f8fafc;
  border-left: 3px solid var(--success-color);
  position: relative;
}

.subtask-item.completed::after {
  content: "COMPLETADA";
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: var(--success-color);
  color: white;
  font-size: 0.5rem;
  font-weight: 600;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.subtask-item.completed .subtask-priority {
  opacity: 0.5;
}

.subtask-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subtask-checkbox {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.subtask-checkbox.checked {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.subtask-order {
  background: var(--warning-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  margin-right: 0.375rem;
  min-width: 1.25rem;
  text-align: center;
}

.subtask-priority {
  font-size: 0.875rem;
  margin-right: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
}

.subtask-title {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.subtask-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

/* 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-color);
  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;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

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

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

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

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

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }
  
  .header .container {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .header-actions {
    justify-content: center;
  }
  
  .timeline-list {
    grid-template-columns: 1fr;
  }
  
  .timeline-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .task-header {
    flex-wrap: wrap;
  }
  
  .task-actions {
    opacity: 1;
  }
  
  .subtasks {
    margin-left: 1rem;
  }
  
  .modal {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  .form-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .main {
    padding: 1rem 0;
  }
  
  .timeline-card {
    padding: 1rem;
  }
  
  .task-item {
    padding: 0.75rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
}

/* Update Notification */
.update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--surface-color);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  max-width: 400px;
  animation: slideInRight 0.3s ease;
}

.update-content {
  display: flex;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
}

.update-icon {
  font-size: 1.5rem;
  animation: spin 2s linear infinite;
}

.update-text {
  flex: 1;
}

.update-text strong {
  display: block;
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

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

.update-actions {
  display: flex;
  gap: 0.5rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.timeline-card,
.task-item,
.subtask-item {
  animation: fadeIn 0.3s ease;
}

/* Drag and Drop */
.task-item.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.drop-zone {
  border: 2px dashed var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  color: var(--primary-color);
  margin: 0.5rem 0;
  transition: all 0.2s ease;
}

.drop-zone.active {
  background: rgba(37, 99, 235, 0.1);
  transform: scale(1.02);
}
