/*
  Admin Console Styles
  Theme: Matches wedding site design tokens
*/

:root {
  --ivory: #FFF9C4;
  --sage: #B8D233;
  --rose: #FF4081;
  --gold: #FFD700;
  --forest: #1B5E20;
  --fiesta-orange: #FF9F1C;
  --fiesta-blue: #4A90E2;
  --white: #FFFFFF;
  --text: #333333;
  --light-gray: #f8f8f8;
  --border: #e0e0e0;
  --danger: #dc3545;
  --transition: all 0.3s ease;
}

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

[hidden] {
  display: none !important;
}

body {
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background-color: var(--light-gray);
  line-height: 1.6;
}

h1, h2, h3, h4, .serif {
  font-family: 'Playfair Display', serif;
  color: var(--forest);
  font-weight: 400;
}

/* ── Login Screen ────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--forest) 0%, #2d5016 50%, var(--sage) 100%);
}

.login-card {
  background: var(--white);
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
  width: 100%;
  max-width: 400px;
  margin: 1rem;
}

.login-card h1 {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

.login-card h2 {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text);
  margin-bottom: 2rem;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-card input[type="password"] {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  transition: var(--transition);
}

.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15);
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover {
  background-color: #2e7d32;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27, 94, 32, 0.3);
}

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

.btn-secondary:hover {
  background-color: #9ab82a;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--white);
  border-color: var(--forest);
  color: var(--forest);
}

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

.btn-danger:hover {
  background-color: #c82333;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
  color: var(--text);
  opacity: 0.6;
  transition: var(--transition);
  font-size: 1rem;
}

.btn-icon:hover {
  opacity: 1;
  background: var(--light-gray);
}

.btn-icon.danger:hover {
  color: var(--danger);
  background: #fde8ea;
}

/* ── Dashboard Layout ────────────────────────────────── */
#dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard {
  width: 100%;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h1 {
  font-size: 1.8rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* ── Stats Grid ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
}

.stat-number {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  color: var(--forest);
  margin-bottom: 0.25rem;
}

.stat-card.stat-accepted .stat-number {
  color: var(--sage);
}

.stat-card.stat-declined .stat-number {
  color: var(--rose);
}

.stat-card.stat-seats .stat-number {
  color: var(--fiesta-orange);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  font-weight: 600;
}

/* ── Tab Navigation ──────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--forest);
}

.tab-btn.active {
  color: var(--forest);
  border-bottom-color: var(--forest);
}

.tab-content {
  display: block;
}

.tab-content[hidden] {
  display: none;
}

/* ── Table Controls ──────────────────────────────────── */
.table-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.filter-select {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  outline: none;
  border-color: var(--forest);
}

/* ── Guest Table ─────────────────────────────────────── */
.table-wrapper {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.guest-table {
  width: 100%;
  border-collapse: collapse;
}

.guest-table thead th {
  background: var(--forest);
  color: var(--white);
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.sort-btn {
  background: none;
  border: none;
  color: var(--white);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
}

.sort-btn:hover {
  opacity: 0.85;
}

.sort-icon {
  font-size: 0.6rem;
  opacity: 0.5;
}

.sort-btn.active .sort-icon {
  opacity: 1;
}

.guest-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.88rem;
  vertical-align: middle;
}

.guest-table tbody tr:hover {
  background-color: #fafafa;
}

.guest-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-accepted {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-declined {
  background: #fce4ec;
  color: #c62828;
}

/* Table assignment select in guest list */
.table-assign-select {
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8rem;
  background: var(--white);
  cursor: pointer;
}

.message-cell {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-cell {
  white-space: nowrap;
  font-size: 0.8rem;
  color: #888;
}

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

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #aaa;
  font-style: italic;
}

.companion-list {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.companion-tag {
  display: inline-block;
  font-size: 0.7rem;
  background: #f0f0f0;
  color: #666;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 400;
}

.table-guest-companions {
  font-size: 0.7rem;
  color: #999;
  font-style: italic;
  margin-top: 0.15rem;
}

/* ── Seating Planner ─────────────────────────────────── */
.seating-controls {
  margin-bottom: 1.5rem;
}

.seating-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.table-card {
  background: var(--white);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.table-card.drag-over {
  border-color: var(--forest);
  box-shadow: 0 0 0 2px rgba(27, 94, 32, 0.2);
}

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

.table-card-header h3 {
  font-size: 1.1rem;
  flex: 1;
}

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

.table-drag-handle {
  cursor: grab;
  font-size: 1.1rem;
  color: #bbb;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.2s;
  user-select: none;
}

.table-drag-handle:hover {
  color: var(--forest);
}

.table-drag-handle:active {
  cursor: grabbing;
}

.table-move-btn {
  font-size: 1.2rem !important;
  padding: 0.15rem 0.3rem !important;
  opacity: 0.4;
}

.table-move-btn:hover {
  opacity: 1 !important;
  color: var(--forest) !important;
  background: rgba(27, 94, 32, 0.06) !important;
}

.table-card.table-dragging {
  opacity: 0.4;
  transform: scale(0.97);
}

.table-card.table-drop-before {
  box-shadow: -4px 0 0 0 var(--forest);
}

.table-card.table-drop-after {
  box-shadow: 4px 0 0 0 var(--forest);
}

.capacity-bar-wrapper {
  margin-bottom: 0.75rem;
}

.capacity-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.3rem;
}

.capacity-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.capacity-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--sage);
  transition: width 0.4s ease;
}

.capacity-fill.warning {
  background: var(--fiesta-orange);
}

.capacity-fill.full {
  background: var(--rose);
}

.table-guests-list {
  list-style: none;
  margin-bottom: 0.75rem;
}

.table-guest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.85rem;
}

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

.table-guest-seats {
  font-size: 0.75rem;
  color: #888;
  margin-left: 0.35rem;
}

.table-drop-zone {
  padding: 0.75rem;
  border: 2px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  color: #bbb;
  font-size: 0.8rem;
  transition: var(--transition);
}

.table-drop-zone.drag-active {
  border-color: var(--forest);
  color: var(--forest);
  background: rgba(27, 94, 32, 0.04);
}

.seating-empty {
  text-align: center;
  padding: 2rem;
  color: #aaa;
  font-style: italic;
}

/* Unassigned guests */
.unassigned-guests {
  background: var(--white);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
}

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

.unassigned-header h3 {
  font-size: 1rem;
}

.unassigned-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ivory);
  color: var(--forest);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.guest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.guest-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--ivory);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: grab;
  transition: var(--transition);
  user-select: none;
}

.guest-chip:active {
  cursor: grabbing;
}

.guest-chip:hover {
  background: #fff3a0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.guest-chip.dragging {
  opacity: 0.5;
}

.guest-chip-seats {
  font-size: 0.7rem;
  color: #888;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
}

/* Mobile assign button on chips */
.chip-assign-btn {
  display: none;
  background: var(--forest);
  color: var(--white);
  border: none;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
}

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

.modal[hidden] {
  display: none;
}

.modal-content {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
  margin-bottom: 1.5rem;
}

.close-modal {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  background: none;
  border: none;
  transition: var(--transition);
}

.close-modal:hover {
  color: var(--text);
}

/* ── Form Elements in Modals ─────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

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

/* ── Admin Photos ────────────────────────────────────── */
.photos-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.photo-stat {
  font-size: 0.85rem;
  color: #666;
}

.photo-stat strong {
  font-size: 1.1rem;
  color: var(--forest);
  margin-right: 0.25rem;
}

.admin-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-photo-card {
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: var(--transition);
}

.admin-photo-card.photo-hidden {
  opacity: 0.5;
}

.admin-photo-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.admin-photo-info {
  padding: 0.75rem;
  font-size: 0.8rem;
}

.admin-photo-info strong {
  display: block;
  margin-bottom: 0.2rem;
}

.admin-photo-date {
  display: block;
  font-size: 0.7rem;
  color: #999;
}

.admin-photo-caption {
  display: block;
  font-size: 0.7rem;
  color: #777;
  font-style: italic;
  margin-top: 0.2rem;
}

.admin-photo-actions {
  padding: 0 0.75rem 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.admin-photo-actions .btn {
  flex: 1;
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard {
    padding: 1rem;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-number {
    font-size: 1.8rem;
  }

  .table-controls {
    flex-direction: column;
  }

  .search-input {
    min-width: 100%;
  }

  .seating-grid {
    grid-template-columns: 1fr;
  }

  .guest-chip .chip-assign-btn {
    display: inline-block;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .header-actions .btn {
    flex: 1;
  }
}
