:root {
  --primary: #2c5f2d;
  --primary-light: #4a8a4d;
  --secondary: #f5a623;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --border: #dddddd;
  --error: #d32f2f;
  --success: #388e3c;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Login Screen */
#login-screen {
  background: url('/cow-bg.jpg') center/cover no-repeat;
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
}

#login-screen.active {
  display: flex;
}

#login-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 0;
}

.login-container {
  max-width: 400px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}

.login-container h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 10px;
}

.login-container .company-name {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 30px;
  letter-spacing: 2px;
}

.login-container input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
}

.login-container button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.login-container button:hover {
  background: var(--primary-light);
}

/* Main App */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

.top-nav {
  background: var(--primary);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-nav h1 {
  font-size: 24px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

#logout-btn {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

#logout-btn:hover {
  background: rgba(255,255,255,0.3);
}

.tab-navigation {
  display: flex;
  background: white;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 15px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-light);
  transition: all 0.3s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  font-weight: 600;
}

.content {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.toolbar {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

.btn-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

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

.btn-search {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--secondary);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-search:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

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

@media (max-width: 768px) {
  .toolbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  .view-select {
    flex: 1;
    max-width: 120px;
  }

  .date-navigation, .date-navigation-closed, .date-navigation-calendar {
    padding: 2px 8px;
    min-width: auto;
    flex: 1;
  }

  #period-label, #period-label-closed, #period-label-calendar {
    font-size: 12px;
    min-width: 80px;
  }

  .nav-btn {
    font-size: 14px;
    padding: 2px 6px;
  }

  .btn-fab {
    right: 20px;
    bottom: 20px;
  }

  .btn-search {
    left: 20px;
    bottom: 20px;
  }

  .task-meta {
    flex-wrap: nowrap;
  }

  .task-meta-left {
    gap: 6px;
  }

  .task-icon {
    font-size: 14px;
  }

  .task-assignee, .task-deadline {
    font-size: 12px;
  }
}

.view-select {
  padding: 10px 12px;
  border: 2px solid var(--primary);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: white;
  color: var(--primary);
  min-width: 120px;
}

.date-navigation, .date-navigation-closed, .date-navigation-calendar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 6px;
}

.nav-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--primary);
  transition: opacity 0.2s;
}

.nav-btn:hover {
  opacity: 0.7;
}

#period-label, #period-label-closed, #period-label-calendar {
  font-size: 14px;
  font-weight: 500;
  min-width: 150px;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

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

.btn-secondary {
  background: var(--border);
  color: var(--text);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

select {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.status-select {
  padding: 8px 12px;
  border: 2px solid var(--primary);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: white;
}

/* List Items */
.list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* New Task Card Design */
.task-card-new {
  background: var(--card-bg);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border-left: 4px solid var(--primary);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.task-card-new:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.task-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding-right: 70px; /* Space for edit/delete buttons */
}

.task-title-large {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.task-deadline-small {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

.task-status-badge {
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.started-by-badge {
  display: inline-block;
  font-size: 13px;
  color: #f57c00;
  font-weight: 600;
  padding: 4px 10px;
  background: #fff3e0;
  border-radius: 4px;
}

.assigned-to-badge {
  display: inline-block;
  font-size: 13px;
  color: #2c5f2d;
  font-weight: 600;
  padding: 4px 10px;
  background: #e8f5e9;
  border-radius: 4px;
}

.completion-note-badge {
  display: inline-block;
  font-size: 13px;
  color: #1976d2;
  font-weight: 600;
  padding: 4px 10px;
  background: #e3f2fd;
  border-radius: 4px;
}

/* Old card styles for other cards */
.task-card, .event-card, .activity-item, .user-card {
  background: var(--card-bg);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border-left: 4px solid var(--primary);
  position: relative;
}

.task-card h3, .event-card h3 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  padding-right: 60px;
}

.card-admin-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-icon:hover {
  opacity: 1;
}

.task-meta, .event-meta {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-light);
}

.event-meta span {
  display: block;
}

.task-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.task-assignee {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-deadline {
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.task-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-todo { background: #e3f2fd; color: #1976d2; }
.status-in_progress { background: #fff3e0; color: #f57c00; }
.status-done { background: #e8f5e9; color: #388e3c; }

.priority-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot.priority-high { background: #d32f2f; }
.priority-dot.priority-medium { background: #f57c00; }
.priority-dot.priority-low { background: #388e3c; }

.task-status-info {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.started-by {
  font-size: 14px;
  color: #f57c00;
  font-weight: 600;
  padding: 6px 12px;
  background: #fff3e0;
  border-radius: 6px;
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-action:active {
  transform: translateY(0);
}

.btn-icon-large {
  font-size: 20px;
}

.btn-text {
  font-size: 14px;
}

.btn-start {
  background: #fff3e0;
  color: #f57c00;
  border: 2px solid #f57c00;
}

.btn-stop {
  background: #ffebee;
  color: #d32f2f;
  border: 2px solid #d32f2f;
}

.btn-done {
  background: #e8f5e9;
  color: #388e3c;
  border: 2px solid #388e3c;
}

.btn-reopen {
  background: #f5f5f5;
  color: #666;
  border: 2px solid #999;
}

/* User Management */
.user-card .card-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-edit, .btn-reset, .btn-delete {
  flex: 1;
  min-width: 100px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-edit {
  background: #e3f2fd;
  color: #1976d2;
  border: 2px solid #1976d2;
}

.btn-edit:hover {
  background: #bbdefb;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(25, 118, 210, 0.2);
}

.btn-reset {
  background: #fff3e0;
  color: #f57c00;
  border: 2px solid #f57c00;
}

.btn-reset:hover {
  background: #ffe0b2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(245, 124, 0, 0.2);
}

.btn-delete {
  background: #ffebee;
  color: #d32f2f;
  border: 2px solid #d32f2f;
}

.btn-delete:hover {
  background: #ffcdd2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(211, 47, 47, 0.2);
}

/* Activity Log */
.activity-item {
  border-left: 3px solid var(--primary);
}

.activity-item strong {
  color: var(--primary);
}

.activity-time {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 5px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

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

.modal-small {
  max-width: 400px;
}

.modal-small h3 {
  margin-bottom: 15px;
  color: var(--primary);
}

.modal-small p {
  margin-bottom: 20px;
  color: var(--text);
}

.modal-content h2 {
  margin-bottom: 20px;
  color: var(--primary);
}

.modal-content label {
  display: block;
  margin-top: 15px;
  margin-bottom: 5px;
  font-weight: 600;
}

.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="datetime-local"],
.modal-content textarea,
.modal-content select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.modal-content input[type="checkbox"] {
  margin-right: 8px;
}

.modal-content input[type="date"],
.modal-content input[type="time"],
.modal-content input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.checkbox-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.checkbox-group label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-weight: normal;
  padding: 5px 10px;
  background: var(--bg);
  border-radius: 4px;
  cursor: pointer;
}

.checkbox-group label:hover {
  background: var(--border);
}

/* Priority Selector */
.priority-selector {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.priority-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 14px;
}

.priority-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.priority-option input[type="radio"] {
  display: none;
}

.priority-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transition: all 0.2s;
}

.priority-option.priority-low-option {
  background: #e8f5e9;
  color: #388e3c;
}

.priority-option.priority-low-option .priority-circle {
  background: #4caf50;
}

.priority-option.priority-low-option input[type="radio"]:checked ~ span {
  font-weight: 700;
}

.priority-option.priority-low-option:has(input[type="radio"]:checked) {
  border-color: #388e3c;
  background: #c8e6c9;
}

.priority-option.priority-medium-option {
  background: #fff3e0;
  color: #f57c00;
}

.priority-option.priority-medium-option .priority-circle {
  background: #ff9800;
}

.priority-option.priority-medium-option:has(input[type="radio"]:checked) {
  border-color: #f57c00;
  background: #ffe0b2;
}

.priority-option.priority-high-option {
  background: #ffebee;
  color: #d32f2f;
}

.priority-option.priority-high-option .priority-circle {
  background: #f44336;
}

.priority-option.priority-high-option:has(input[type="radio"]:checked) {
  border-color: #d32f2f;
  background: #ffcdd2;
}

/* Deadline Row */
.deadline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 15px;
}

.deadline-field {
  display: flex;
  flex-direction: column;
}

.deadline-field label {
  margin-bottom: 5px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}

.modal-buttons button {
  flex: 1;
}

.error {
  color: var(--error);
  margin-top: 10px;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

/* Task Details Modal */
.task-details-grid {
  display: grid;
  gap: 16px;
  margin: 20px 0;
}

.detail-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-item strong {
  display: block;
  color: var(--primary);
  margin-bottom: 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-item p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.priority-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.priority-badge.priority-high {
  background: #ffebee;
  color: #d32f2f;
}

.priority-badge.priority-medium {
  background: #fff3e0;
  color: #f57c00;
}

.priority-badge.priority-low {
  background: #e8f5e9;
  color: #388e3c;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .content {
    padding: 15px;
  }

  .top-nav h1 {
    font-size: 18px;
  }

  .user-info span {
    display: none;
  }

  .tab-btn {
    font-size: 14px;
    padding: 12px 8px;
  }

  .task-meta, .event-meta {
    flex-direction: column;
    gap: 8px;
  }

  .deadline-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
