/* ══════════════════════════════════════════
   ADMIN STYLES - Frutta e Verdura di Remus
   ══════════════════════════════════════════ */

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

:root {
  --primary: #1a472a;
  --primary-light: #2d6a2d;
  --primary-dark: #0f2e0f;
  --accent: #c9a227;
  --bg: #f5f5f0;
  --card-bg: #fff;
  --text: #333;
  --text-light: #666;
  --border: #e0e0e0;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --pending: #f59e0b;
  --confirmed: #3b82f6;
  --delivered: #22c55e;
  --cancelled: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ══════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 20px;
}

.login-box {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 10px;
}

.login-box h1 {
  color: var(--primary);
  font-size: 24px;
  margin-bottom: 8px;
}

.login-box p {
  color: var(--text-light);
  margin-bottom: 30px;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-form input {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-btn {
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
}

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

.login-btn:active {
  transform: scale(0.98);
}

.login-error {
  color: var(--error);
  font-size: 14px;
  margin-top: 12px;
  display: none;
}

.login-error.show {
  display: block;
}

.login-hint {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 12px;
}

/* ══════════════════════════════════════════
   ADMIN DASHBOARD
   ══════════════════════════════════════════ */

.admin-dashboard {
  min-height: 100vh;
}

/* Header */
.admin-header {
  background: var(--primary);
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-logo {
  font-size: 20px;
  font-weight: 600;
}

.header-date {
  font-size: 14px;
  opacity: 0.9;
  margin-right: 20px;
}

.logout-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Main Content */
.admin-main {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-light);
}

/* Filters */
.filters-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filter-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--bg);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Orders Sections */
.orders-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.orders-section h2 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.orders-table th {
  text-align: left;
  padding: 12px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.orders-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.orders-table tr:hover {
  background: var(--bg);
}

.empty-msg {
  text-align: center;
  color: var(--text-light);
  padding: 40px !important;
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-confirmed {
  background: #dbeafe;
  color: #1e40af;
}

.status-delivered {
  background: #d1fae5;
  color: #065f46;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Actions */
.actions-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

.action-btn {
  padding: 12px 24px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--bg);
}

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

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

/* Table Actions */
.table-actions {
  display: flex;
  gap: 6px;
}

.action-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
  text-decoration: none;
}

.action-icon:hover {
  background: var(--bg);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  color: var(--primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--border);
}

.modal-body {
  padding: 24px;
}

/* Modal Order Details */
.order-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.order-detail-label {
  font-weight: 600;
  color: var(--text-light);
}

.order-detail-value {
  text-align: right;
}

.order-products-list {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  margin-top: 8px;
}

.order-product-item {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

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

/* Status Selector in Modal */
.status-selector {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--border);
}

.status-option {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.status-option:hover {
  border-color: var(--primary);
}

.status-option.active.status-pending {
  background: var(--pending);
  color: white;
  border-color: var(--pending);
}

.status-option.active.status-confirmed {
  background: var(--confirmed);
  color: white;
  border-color: var(--confirmed);
}

.status-option.active.status-delivered {
  background: var(--delivered);
  color: white;
  border-color: var(--delivered);
}

.status-option.active.status-cancelled {
  background: var(--cancelled);
  color: white;
  border-color: var(--cancelled);
}

/* Contact Buttons */
.contact-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.contact-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.1s;
}

.contact-btn:active {
  transform: scale(0.98);
}

.contact-btn.phone {
  background: #dbeafe;
  color: #1e40af;
}

.contact-btn.whatsapp {
  background: #d1fae5;
  color: #065f46;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */

@media (max-width: 768px) {
  .admin-main {
    padding: 16px;
  }

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

  .stat-value {
    font-size: 24px;
  }

  .filters-bar {
    padding: 12px;
  }

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

  .orders-section {
    padding: 16px;
  }

  .orders-section h2 {
    font-size: 16px;
  }

  .table-wrapper {
    margin: 0 -16px;
    padding: 0 16px;
  }

  .orders-table {
    font-size: 13px;
  }

  .orders-table th,
  .orders-table td {
    padding: 10px 8px;
  }

  /* Hide less important columns on mobile */
  .orders-table th:nth-child(3),
  .orders-table td:nth-child(3),
  .orders-table th:nth-child(6),
  .orders-table td:nth-child(6) {
    display: none;
  }

  .admin-header {
    padding: 12px 16px;
  }

  .header-date {
    display: none;
  }

  .modal-content {
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 480px) {
  .login-box {
    padding: 30px 24px;
  }

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

  .actions-bar {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
  }
}

/* ══════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════ */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mb-0 {
  margin-bottom: 0;
}

.mt-20 {
  margin-top: 20px;
}
