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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Login page */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-container {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 2rem;
}

.login-container h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #34495e;
}

.login-container input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.login-container button {
  width: 100%;
  padding: 0.75rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

.login-container button:hover {
  background: #2980b9;
}

.error {
  color: #e74c3c;
  padding: 0.5rem;
  background: #fadbd8;
  border-radius: 4px;
  margin-top: 1rem;
  text-align: center;
}

/* Main app */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.app-header {
  background: white;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.app-header h1 {
  color: #2c3e50;
  font-size: 1.5rem;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
}

.nav-tabs button {
  padding: 0.5rem 1rem;
  background: #ecf0f1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s;
}

.nav-tabs button.active {
  background: #3498db;
  color: white;
}

.nav-tabs button:hover:not(.active) {
  background: #d5dbdb;
}

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

.btn {
  padding: 0.5rem 1rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s;
}

.btn:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
}

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

.btn-success {
  background: #27ae60;
}

.btn-success:hover {
  background: #229954;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* Icon buttons */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
}

.btn-icon:hover {
  transform: scale(1.1);
}

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

.btn-icon.btn-primary {
  background: #3498db;
  color: white;
}

.btn-icon.btn-primary:hover {
  background: #2980b9;
}

.btn-icon.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-icon.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-icon.btn-success {
  background: #27ae60;
  color: white;
}

.btn-icon.btn-success:hover {
  background: #229954;
}

.btn-icon.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-icon.btn-danger:hover {
  background: #c0392b;
}

.btn-icon.btn-warning {
  background: #f39c12;
  color: white;
}

.btn-icon.btn-warning:hover {
  background: #d68910;
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* Weekly Focus View */
.weekly-focus-container {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.weekly-focus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #3498db;
}

.weekly-focus-header h2 {
  color: #2c3e50;
}

.week-info {
  font-size: 0.9rem;
  color: #7f8c8d;
}

.focus-items {
  margin-bottom: 2rem;
}

.focus-item {
  background: #e8f4f8;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 4px;
  border-left: 4px solid #3498db;
}

.empty-focus {
  text-align: center;
  padding: 2rem;
  color: #95a5a6;
  font-style: italic;
}

.reminders-section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ecf0f1;
}

.reminders-section h3 {
  color: #34495e;
  margin-bottom: 1rem;
}

.reminder-item {
  background: #fff9e6;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  border-left: 4px solid #f39c12;
}

/* Items */
.item {
  background: white;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  border-left: 4px solid #bdc3c7;
}

.item.type-note {
  border-left-color: #f39c12;
  background: #fffbf0;
}

.item.type-project {
  border-left-color: #9b59b6;
  background: #f8f4fb;
}

.item.type-task {
  border-left-color: #3498db;
  background: #f0f8ff;
}

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

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: #2c3e50;
  word-wrap: break-word;
}

.item-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.item-type-badge {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  background: #95a5a6;
  color: white;
  text-transform: uppercase;
}

.item-type-badge.type-note {
  background: #f39c12;
}

.item-type-badge.type-project {
  background: #9b59b6;
}

.item-type-badge.type-task {
  background: #3498db;
}

.item-status {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  background: #ecf0f1;
  color: #7f8c8d;
}

.item-status.status-in_progress {
  background: #fff3cd;
  color: #856404;
}

.item-status.status-done {
  background: #d4edda;
  color: #155724;
}

.item-tags {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  background: #e8f4f8;
  color: #2980b9;
}

.item-description {
  margin: 0.5rem 0;
  color: #555;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.item-recurring {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.counter-display {
  font-weight: 600;
  color: #27ae60;
}

.item-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.item-children {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
  border-left: 2px solid #ecf0f1;
  padding-left: 0.5rem;
}

.collapse-toggle {
  cursor: pointer;
  user-select: none;
  color: #7f8c8d;
  font-weight: bold;
  margin-right: 0.25rem;
}

.collapse-toggle:hover {
  color: #34495e;
}

.child-count {
  font-size: 0.8rem;
  color: #95a5a6;
  margin-right: 0.5rem;
}

/* All Items View */
.all-items-container {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.all-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #34495e;
}

/* Stats View */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #3498db;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #3498db;
  margin: 0.5rem 0;
}

.stat-label {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ecf0f1;
}

.chart {
  margin-top: 1rem;
  height: 200px;
  background: #f8f9fa;
  border-radius: 4px;
  padding: 1rem;
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
}

.chart-bar {
  flex: 1;
  background: #3498db;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  position: relative;
}

.chart-bar.completed {
  background: #27ae60;
}

.chart-bar.added {
  background: #e74c3c;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ecf0f1;
}

.modal-header h2 {
  color: #2c3e50;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #95a5a6;
  padding: 0;
  width: 30px;
  height: 30px;
}

.close-modal:hover {
  color: #7f8c8d;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  color: #34495e;
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

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

.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  flex-wrap: nowrap;
}

.form-actions .btn-icon {
  flex-shrink: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-tabs {
    flex-direction: column;
  }

  .header-actions {
    flex-direction: column;
  }

  .item-header {
    flex-direction: column;
  }

  .item-actions {
    width: 100%;
  }

  .stats-container {
    grid-template-columns: 1fr;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mt-1 {
  margin-top: 1rem;
}
