/* Reset and base styles */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
}

/* Navbar */
.navbar {
  background: #1a1a2e;
  color: white;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.nav-brand a {
  color: white;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 0.5rem;
}

.nav-links a:hover {
  color: white;
}

.user-name {
  color: rgba(255,255,255,0.6);
  padding: 0 0.5rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Login page */
.login-page {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: white;
  padding: 3rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.login-box h1 {
  margin: 0 0 0.5rem;
  color: #1a1a2e;
}

.login-box p {
  color: #666;
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  background: #e0e0e0;
  color: #333;
  transition: background 0.2s;
}

.btn:hover {
  background: #d0d0d0;
}

.btn-primary {
  background: #0f4c75;
  color: white;
}

.btn-primary:hover {
  background: #0d3d5c;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

.btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-google {
  background: white;
  color: #333;
  border: 1px solid #ddd;
  padding: 0.75rem 2rem;
}

.btn-google:hover {
  background: #f8f8f8;
}

.btn-google svg {
  margin-right: 0.5rem;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  margin: 0;
  color: #1a1a2e;
}

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.project-card h2 {
  margin: 0 0 1rem;
  color: #1a1a2e;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  color: #666;
  font-size: 0.875rem;
}

/* Admin grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.admin-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.admin-card:hover {
  transform: translateY(-2px);
}

.admin-card h2 {
  margin: 0 0 0.5rem;
  color: #0f4c75;
}

.admin-card p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

/* Tables */
.data-table {
  width: 100%;
  background: white;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Forms */
.form {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  max-width: 500px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0f4c75;
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: #666;
  font-size: 0.875rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input[type="text"] {
  padding: 0.4rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.inline {
  display: inline;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
}

/* Add form section */
.add-form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.add-form h3 {
  margin: 0 0 1rem;
  color: #333;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: #e0e0e0;
}

.badge-admin {
  background: #0f4c75;
  color: white;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.empty-state p {
  color: #666;
  margin-bottom: 1rem;
}

/* Error page */
.error-page {
  text-align: center;
  padding: 3rem;
}

.error-page h1 {
  color: #dc3545;
}

/* Project view */
.project-view {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.project-header {
  background: #1a1a2e;
  color: white;
  padding: 1.5rem 2rem;
}

.project-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.week-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.week-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
}

.week-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.week-selector label {
  font-weight: 500;
  color: #666;
}

.week-selector select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.week-number {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f4c75;
}

/* Tasks */
.tasks-container {
  padding: 2rem;
}

.task-block {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}

.task-block.saving {
  border-color: #ffc107;
}

.task-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.task-row:last-child {
  margin-bottom: 0;
}

.field {
  flex: 1;
  min-width: 200px;
}

.field-sm {
  flex: 0 0 120px;
  min-width: 80px;
}

.field-md {
  flex: 0 0 180px;
  min-width: 140px;
}

.field-tco {
  flex: 0 0 250px;
  min-width: 200px;
}

.field-full {
  flex: 1 1 100%;
}

.field-readonly {
  flex: 0 0 150px;
}

.field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
}

.field .optional {
  font-weight: normal;
  color: #999;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.field textarea {
  min-height: 100px;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: #f0f0f0;
  cursor: not-allowed;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #0f4c75;
}

.pc-display {
  display: block;
  padding: 0.5rem;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #495057;
  min-height: 36px;
}

.task-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.save-status {
  font-size: 0.875rem;
  color: #666;
}

.save-status.saved {
  color: #28a745;
}

.add-task-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

/* Week navigation */
.week-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: #f8f9fa;
  border-top: 1px solid #eee;
}

.week-nav-top {
  border-top: none;
  border-bottom: 1px solid #eee;
}

.week-nav span {
  font-weight: 500;
  color: #666;
}

.week-nav .short-text {
  display: none;
}

.week-nav .full-text {
  display: inline;
}

/* Utility */
.text-muted {
  color: #999;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .navbar {
    flex-direction: column;
    height: auto;
    padding: 1rem;
    gap: 0.5rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .week-info {
    grid-template-columns: 1fr;
  }

  .week-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .week-item {
    width: 100%;
    justify-content: space-between;
  }

  .task-row {
    flex-direction: column;
  }

  .field,
  .field-sm,
  .field-md,
  .field-tco,
  .field-readonly {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .field textarea {
    min-height: 120px;
  }

  .form-actions {
    flex-direction: column;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  .week-nav .short-text {
    display: inline;
  }

  .week-nav .full-text {
    display: none;
  }

  .week-nav .btn {
    white-space: nowrap;
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
  }
}
