/* Subscription Delivery Schedules — admin page styling */

.sub-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.sub-section-header {
  margin-bottom: 18px;
}

.sub-section-header h2,
.sub-section-header h3 {
  margin: 0 0 6px;
  color: #1f3a1f;
}

.sub-section-sub {
  margin: 0;
  color: #5a6b5a;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* Form */
.sub-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.sub-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-field-wide {
  grid-column: 1 / -1;
}

.sub-field label {
  font-weight: 600;
  color: #1f3a1f;
  font-size: 0.9rem;
}

.sub-field input,
.sub-field select,
.sub-field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #cfd8cf;
  background: #f9fff9;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sub-field input:focus,
.sub-field select:focus,
.sub-field textarea:focus {
  outline: none;
  border-color: #66bb6a;
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

.sub-field textarea {
  resize: vertical;
  min-height: 70px;
}

/* Schedule builder */
.sub-schedule-builder {
  background: linear-gradient(180deg, #f6fff6 0%, #ffffff 100%);
  border: 1px dashed #b7d9b7;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
}

.sub-days-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.sub-day-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #dfe8df;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 4px 10px rgba(20, 40, 20, 0.05);
}

.sub-day-row::before {
  content: "📅";
  font-size: 1.1rem;
}

.sub-day-row input[type="date"] {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cfd8cf;
  background: #f9fff9;
  font-size: 0.92rem;
}

.sub-times {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1;
}

.sub-time-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #eef7ef;
  border-radius: 8px;
  padding: 4px 6px 4px 10px;
}

.sub-time-slot input[type="time"] {
  border: none;
  background: transparent;
  font-size: 0.92rem;
  padding: 4px 2px;
}

.sub-time-slot input[type="time"]:focus {
  outline: none;
}

.sub-add-time-btn,
.sub-remove-time-btn,
.sub-remove-day-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.sub-add-time-btn:hover,
.sub-remove-time-btn:hover,
.sub-remove-day-btn:hover {
  transform: scale(1.08);
  opacity: 0.9;
}

.sub-add-time-btn {
  background: #2e7d32;
  color: #fff;
}

.sub-remove-time-btn {
  background: #cfd8cf;
  color: #37473a;
  width: 20px;
  height: 20px;
  font-size: 0.8rem;
}

.sub-remove-day-btn {
  background: #dc3545;
  color: #fff;
  margin-left: auto;
}

.sub-add-day-btn {
  background: #eef7ef;
  color: #1b5e20;
  border: 1px dashed #81c784;
  font-weight: 600;
}

.sub-add-day-btn:hover {
  background: #dff2e0;
}

.sub-form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Toolbar / filters */
.sub-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.sub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.sub-filter-tabs {
  display: flex;
  gap: 6px;
  background: #eef7ef;
  padding: 4px;
  border-radius: 10px;
}

.sub-filter-tab {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #4b5c4b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sub-filter-tab.active {
  background: #2e7d32;
  color: #fff;
}

.sub-search-input {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #cfd8cf;
  background: #f9fff9;
  font-size: 0.9rem;
  min-width: 220px;
}

.sub-search-input:focus {
  outline: none;
  border-color: #66bb6a;
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

/* Stats bar */
.sub-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 20px;
}

.sub-stat-chip {
  flex: 1;
  min-width: 140px;
  background: #ffffff;
  border: 1px solid #e1e7e1;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 6px 14px rgba(20, 40, 20, 0.06);
}

.sub-stat-chip .sub-stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1b5e20;
}

.sub-stat-chip.is-warning .sub-stat-value {
  color: #b8860b;
}

.sub-stat-chip.is-danger .sub-stat-value {
  color: #b00020;
}

.sub-stat-chip .sub-stat-label {
  font-size: 0.8rem;
  color: #5a6b5a;
}

/* Subscription list */
.sub-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sub-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #5a6b5a;
  background: #f6fff6;
  border: 1px dashed #b7d9b7;
  border-radius: 14px;
}

.sub-empty-state .sub-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.sub-card {
  border: 1px solid #e1e7e1;
  border-left: 5px solid #66bb6a;
  border-radius: 14px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(20, 40, 20, 0.07);
  transition: box-shadow 0.15s ease;
}

.sub-card:hover {
  box-shadow: 0 10px 26px rgba(20, 40, 20, 0.12);
}

.sub-card.is-cancelled {
  border-left-color: #dc3545;
  opacity: 0.85;
}

.sub-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.sub-card-header h3 {
  margin: 0 0 6px;
  color: #1f3a1f;
  font-family: 'Playfair Display', serif;
}

.sub-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sub-card-actions .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-warning {
  background: #ffc107 !important;
  color: #3a2c00 !important;
}

.btn-danger {
  background: #dc3545 !important;
  color: #fff !important;
}

.sub-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  margin-bottom: 14px;
  font-size: 0.92rem;
  color: #37473a;
}

.sub-meta-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.sub-meta-wide {
  grid-column: 1 / -1;
}

.sub-schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
}

.sub-schedule-table th {
  text-align: left;
  padding: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5a6b5a;
  border-bottom: 2px solid #e1e7e1;
}

.sub-schedule-table td {
  border-bottom: 1px solid #eef2ee;
  text-align: left;
  padding: 8px;
  font-size: 0.9rem;
}

.sub-schedule-table tr:last-child td {
  border-bottom: none;
}

.sub-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.sub-status.pending { background: #fff3cd; color: #856404; }
.sub-status.notified { background: #cce5ff; color: #004085; }
.sub-status.delivered { background: #d4edda; color: #155724; }
.sub-status.active { background: #d4edda; color: #155724; }
.sub-status.cancelled { background: #f8d7da; color: #721c24; }

@media (max-width: 900px) {
  .sub-form-grid {
    grid-template-columns: 1fr;
  }

  .sub-meta-grid {
    grid-template-columns: 1fr;
  }

  .sub-list-header {
    align-items: stretch;
  }

  .sub-toolbar {
    justify-content: space-between;
  }

  .sub-search-input {
    flex: 1;
    min-width: 0;
  }
}
