/* === Admin Layout === */
.admin-body {
  margin: 0;
  background: #f0f2f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #333;
  line-height: 1.6;
}

.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.admin-sidebar {
  width: 240px;
  background: #002a5c;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand a {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  flex: 1;
}

.sidebar-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(105,190,40,0.2);
  color: #69be28;
  font-weight: 600;
}

.sidebar-nav hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 0.75rem 0;
}

.sidebar-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-height: 44px;
  transition: all 0.15s ease;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* === Main Area === */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: #fff;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-page-title {
  font-size: 1.5rem;
  color: #002a5c;
  margin: 0;
  font-weight: 600;
}

.admin-sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.admin-content {
  padding: 2rem;
  flex: 1;
}

/* === Flash Messages === */
.flash {
  padding: 1rem 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border-bottom: 1px solid #c3e6cb;
}

.flash-error {
  background: #f8d7da;
  color: #721c24;
  border-bottom: 1px solid #f5c6cb;
}

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

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.75rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-number {
  font-size: 2.25rem;
  font-weight: 700;
  color: #002a5c;
  line-height: 1.2;
}

.stat-label {
  color: #666;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* === Admin Grid === */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-panel {
  background: #fff;
  border-radius: 8px;
  padding: 1.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}

.admin-panel h3 {
  color: #002a5c;
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

/* === Tables === */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f8f8f8;
  color: #002a5c;
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: #f8f9fa;
}

.admin-table a {
  text-decoration: underline;
}

.admin-table a:hover {
  color: #69be28;
}

.detail-table {
  width: 100%;
  font-size: 0.9rem;
}

.detail-table th {
  text-align: left;
  padding: 0.75rem 1rem 0.75rem 0;
  color: #666;
  font-weight: 600;
  width: 160px;
  vertical-align: top;
}

.detail-table td {
  padding: 0.75rem 0;
}

/* === Badges === */
.badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.2;
}

.badge-active, .badge-completed {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.badge-pending {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.badge-expired, .badge-failed {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.badge-cancelled, .badge-refunded {
  background: #e2e3e5;
  color: #383d41;
  border: 1px solid #d6d8db;
}

/* === Toolbar === */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-form input {
  padding: 0.625rem 0.875rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 40px;
}

.search-form input:focus {
  outline: none;
  border-color: #002a5c;
  box-shadow: 0 0 0 3px rgba(0,42,92,0.1);
}

/* === Forms === */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.admin-content .form-group {
  margin-bottom: 1.25rem;
}

.admin-content .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
}

.admin-content .form-group input[type="text"],
.admin-content .form-group input[type="email"],
.admin-content .form-group input[type="tel"],
.admin-content .form-group input[type="url"],
.admin-content .form-group input[type="number"],
.admin-content .form-group input[type="password"],
.admin-content .form-group input[type="date"],
.admin-content .form-group select,
.admin-content .form-group textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.5;
  min-height: 44px;
}

.admin-content .form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.admin-content .form-group input:focus,
.admin-content .form-group select:focus,
.admin-content .form-group textarea:focus {
  outline: none;
  border-color: #002a5c;
  box-shadow: 0 0 0 3px rgba(0,42,92,0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

/* === Buttons === */
.btn {
  display: inline-block;
  background: #69be28;
  color: #fff;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 44px;
  text-align: center;
  text-decoration: none;
}

.btn:hover {
  background: #5aa622;
  text-decoration: none;
  color: #fff;
}

.btn-primary {
  background: #002a5c;
}

.btn-primary:hover {
  background: #001d42;
}

.btn-sm {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  border-radius: 4px;
  background: #002a5c;
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.5;
  min-height: 36px;
  font-weight: 600;
  margin: 0.2rem;
}

.btn-sm:hover {
  background: #001d42;
  text-decoration: none;
  color: #fff;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  min-height: 44px;
  text-decoration: none;
}

.btn-danger:hover {
  background: #c82333;
  text-decoration: none;
  color: #fff;
}

.btn-sm.btn-danger {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  min-height: 36px;
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.95rem;
}

.pagination a {
  color: #002a5c;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.pagination a:hover {
  text-decoration: underline;
  color: #69be28;
}

/* === Gallery Admin === */
.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.gallery-admin-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 0.75rem;
}

.gallery-admin-info {
  padding: 0.75rem 0;
  font-size: 0.875rem;
}

.gallery-admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* === Card Row === */
.card-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

/* === Login === */
.admin-login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #002a5c;
  margin: 0;
}

.admin-login-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 8px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.admin-login-card h2 {
  color: #002a5c;
  margin-bottom: 1.5rem;
}

/* === Utility === */
.text-muted {
  color: #999;
  font-size: 0.9rem;
}

/* === Draft Restored Banner === */
.draft-restored-banner {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.draft-discard-btn {
  background: none;
  border: 1px solid #0c5460;
  color: #0c5460;
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.draft-discard-btn:hover {
  background: #0c5460;
  color: #fff;
}

/* === Responsive === */
@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.2s;
  }

  .sidebar-open .admin-sidebar {
    left: 0;
  }

  .admin-sidebar-toggle {
    display: block;
  }

  .admin-content {
    padding: 1.5rem;
  }

  .admin-topbar {
    padding: 1rem 1.5rem;
  }

  .admin-page-title {
    font-size: 1.25rem;
  }

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

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

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

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form {
    width: 100%;
  }

  .search-form input {
    flex: 1;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  .admin-content .form-group input,
  .admin-content .form-group select,
  .admin-content .form-group textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  .admin-table {
    font-size: 0.85rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.75rem;
  }

  .btn,
  .btn-danger {
    width: 100%;
    text-align: center;
  }

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

  .form-actions .btn,
  .form-actions .btn-danger {
    width: 100%;
  }
}
