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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

/* Login */
.login-box {
  max-width: 360px;
  margin: 120px auto;
  padding: 40px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.login-box h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.subtitle {
  color: #888;
  margin-bottom: 24px;
}

.login-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 12px;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #333;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.login-box button:hover {
  background: #555;
}

/* Header */
header {
  background: white;
  padding: 16px 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

header h1 {
  font-size: 20px;
}

.user-badge {
  background: #333;
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}

nav {
  display: flex;
  gap: 4px;
}

.tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
}

.tab.active {
  background: #333;
  color: white;
}

.tab:hover:not(.active) {
  background: #eee;
}

/* Tab Content */
.tab-content {
  max-width: 800px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Menu Select */
.menu-header {
  margin-bottom: 16px;
}

.filter-bar {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #666;
}

.filter-btn.active {
  background: #333;
  color: white;
  border-color: #333;
}

.filter-btn:hover:not(.active) {
  background: #f5f5f5;
}

.search-input {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.menu-header select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  background: white;
}

/* Dish Cards */
.dish-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dish-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-left: 4px solid #ddd;
  transition: border-color 0.2s;
}

.dish-card.selected {
  background: #f0faf0;
}

.selected-badge {
  display: inline-block;
  background: #4caf50;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
  vertical-align: middle;
}

.time-ago {
  font-size: 11px;
  color: #999;
  font-weight: 400;
  margin-right: 6px;
  vertical-align: middle;
}

.dish-card.both-liked {
  border-left-color: #4caf50;
}

.dish-card.both-disliked {
  border-left-color: #f44336;
}

.dish-card.mixed {
  border-left-color: #ff9800;
}

.dish-card.partial {
  border-left-color: #90caf9;
}

.dish-info {
  flex: 1;
  min-width: 0;
}

.dish-name-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.dish-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.dish-info h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.dish-info h3 a {
  color: #333;
  text-decoration: none;
}

.dish-info h3 a:hover {
  color: #1976d2;
  text-decoration: underline;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: #e8eaf6;
  color: #3f51b5;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
}

.tag.removable {
  padding-right: 4px;
}

.remove-tag {
  border: none;
  background: none;
  cursor: pointer;
  color: #3f51b5;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.edit-tags-btn {
  border: 1px dashed #bbb;
  background: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  color: #999;
}

.edit-tags-btn:hover {
  border-color: #666;
  color: #666;
}

/* Score Bar */
.score-bar {
  height: 4px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 4px;
}

.score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.score-label {
  font-size: 11px;
  color: #999;
}

/* Votes */
.vote-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.voter {
  display: flex;
  align-items: center;
  gap: 4px;
}

.voter-name {
  font-size: 12px;
  color: #888;
  width: 42px;
  text-align: right;
}

.vote-btn {
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}

.vote-btn:hover {
  background: #f5f5f5;
}

.vote-btn.active {
  border-color: #333;
  background: #f0f0f0;
  box-shadow: 0 0 0 1px #333;
}

.vote-indicator {
  font-size: 16px;
  padding: 4px 8px;
  opacity: 0.5;
}

.vote-indicator.liked, .vote-indicator.disliked {
  opacity: 1;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}

.dish-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.dish-input-row .dish-name {
  flex: 1;
}

.dish-input-row .dish-url {
  flex: 1.5;
}

.remove-row {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 20px;
  color: #ccc;
  padding: 4px;
}

.remove-row:hover {
  color: #f44336;
}

.btn-primary {
  padding: 10px 24px;
  background: #333;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.btn-primary:hover {
  background: #555;
}

.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f5f5f5;
}

/* Request Builder */
.request-header {
  text-align: center;
  margin-bottom: 20px;
}

.request-header h2 {
  margin-bottom: 4px;
}

.request-header .subtitle {
  color: #888;
  margin-bottom: 0;
}

.request-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
}

.pick-count {
  font-weight: 400;
  color: #999;
  font-size: 13px;
}

.request-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.request-slot {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.request-slot.filled {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
}

.request-slot.empty {
  background: #fafafa;
  border: 1px dashed #ddd;
  color: #999;
  cursor: pointer;
  justify-content: center;
  width: 100%;
}

.request-slot.empty:hover {
  background: #f0f0f0;
  border-color: #bbb;
}

.remove-pick {
  border: none;
  background: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
}

.remove-pick:hover {
  color: #f44336;
}

.request-actions {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.request-preview {
  margin-top: 20px;
}

.request-preview h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.message-box {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 12px;
}

.copy-status {
  color: #4caf50;
  font-size: 13px;
  font-weight: 500;
  margin-left: 8px;
}

/* Pick Modal */
.pick-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 10px;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.pick-item:hover {
  background: #f0f0f0;
}

.pick-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

.pick-thumb-empty {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #eee;
}

/* Calendar */
.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-week {
  background: white;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.calendar-week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.calendar-week-header h3 {
  font-size: 15px;
  margin: 0;
}

.calendar-count {
  font-size: 12px;
  color: #999;
}

.calendar-dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-dish {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid #eee;
  background: #fafafa;
}

.calendar-dish.cal-liked {
  background: #e8f5e9;
  border-color: #c8e6c9;
}

.calendar-dish.cal-disliked {
  background: #ffebee;
  border-color: #ffcdd2;
}

.cal-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.cal-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-votes {
  font-size: 12px;
}

.cal-empty {
  color: #ccc;
  font-size: 13px;
  font-style: italic;
}

.calendar-stats {
  margin-top: 20px;
  padding: 16px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.calendar-stats h3 {
  font-size: 14px;
  margin-bottom: 10px;
}

.stat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stat-tag {
  background: #e8eaf6;
  color: #3f51b5;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #999;
  padding: 48px 16px;
}

/* Messages */
.success {
  color: #4caf50;
  font-weight: 500;
}

.error {
  color: #f44336;
  font-weight: 500;
}

/* History */
.history-section {
  margin-bottom: 8px;
}

.history-week {
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  font-size: 16px;
}

.history-week:hover {
  background: #fafafa;
}

.history-section .dish-list {
  padding: 12px 0;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.visible {
  display: flex;
  z-index: 100;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 16px;
}

.modal-close {
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.modal-body .tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  min-height: 32px;
}

.modal-body .form-group {
  display: flex;
  gap: 8px;
}

.modal-body .form-group input {
  flex: 1;
}

/* Responsive */
@media (max-width: 600px) {
  header {
    padding: 10px 12px;
  }

  .header-row {
    margin-bottom: 8px;
  }

  header h1 {
    font-size: 16px;
  }

  .user-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  nav {
    overflow-x: auto;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  .tab-content {
    padding: 0 10px;
    margin: 12px auto;
  }

  .menu-header select {
    font-size: 14px;
    padding: 8px 10px;
  }

  .filter-bar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .filter-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .search-input {
    min-width: 0;
    font-size: 14px;
  }

  .dish-card {
    flex-direction: column;
    padding: 12px;
    gap: 10px;
  }

  .dish-name-row {
    gap: 8px;
  }

  .dish-thumb {
    width: 48px;
    height: 48px;
  }

  .dish-info h3 {
    font-size: 14px;
    line-height: 1.3;
  }

  .selected-badge {
    font-size: 9px;
    padding: 1px 5px;
    margin-right: 4px;
  }

  .time-ago {
    font-size: 10px;
    display: block;
    margin-top: 2px;
  }

  .tags {
    gap: 3px;
  }

  .tag {
    font-size: 10px;
    padding: 1px 6px;
  }

  .vote-section {
    flex-direction: row;
    gap: 16px;
    padding-top: 4px;
    border-top: 1px solid #eee;
  }

  .voter-name {
    font-size: 11px;
    width: 28px;
  }

  .vote-btn {
    padding: 6px 10px;
    font-size: 18px;
  }

  .dish-input-row {
    flex-wrap: wrap;
  }

  .dish-input-row .dish-name,
  .dish-input-row .dish-url {
    flex: 1 1 100%;
  }

  .login-box {
    margin: 60px 16px;
    padding: 28px 20px;
  }

  .login-box h1 {
    font-size: 20px;
  }

  .shuffle-header h2 {
    font-size: 18px;
  }

  .modal-content {
    width: 95%;
    padding: 16px;
  }
}
