/* PakPulse - Modern E-commerce Styles */
:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --dark: #0f172a;
  --dark-light: #1e293b;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --gray: #64748b;
  --gray-light: #f1f5f9;
  --white: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-light);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ========== HEADER ========== */
.header {
  background: var(--dark);
  color: var(--white);
  padding: 0.8rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.logo span {
  color: var(--primary-light);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  opacity: 0.9;
}

.nav a:hover {
  color: var(--primary-light);
  opacity: 1;
}

.admin-link {
  background: var(--primary);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem !important;
}

.admin-link:hover {
  background: var(--primary-dark);
  color: white !important;
}

/* ========== HERO ========== */
.hero {
  background: linear-gradient(135deg, var(--dark) 0%, #134e4a 100%);
  color: white;
  padding: 3rem 1.2rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 0.6rem;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.search-box {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: white;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.search-box input {
  flex: 1;
  border: none;
  padding: 0.9rem 1.4rem;
  font-size: 1rem;
  outline: none;
}

.search-box button {
  background: var(--primary);
  border: none;
  color: white;
  padding: 0 1.4rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.search-box button:hover {
  background: var(--primary-dark);
}

/* ========== MAIN CONTENT ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 2px;
}

/* ========== CATEGORY FILTERS ========== */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.8rem;
}

.category-btn {
  background: white;
  border: 1.5px solid #e2e8f0;
  color: var(--dark);
  padding: 0.5rem 1.1rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.category-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

/* ========== PRODUCTS GRID ========== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.product-img {
  height: 200px;
  background: var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}

.product-body {
  padding: 1.1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-category {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.product-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0.5rem 0;
}

.product-price span {
  font-size: 0.85rem;
  color: var(--gray);
  font-weight: 400;
  text-decoration: line-through;
  margin-left: 0.4rem;
}

.product-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

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

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

.btn-whatsapp {
  background: #25d366;
  color: white;
  flex: 1;
}

.btn-whatsapp:hover {
  background: #1da851;
}

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

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

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

.btn-danger:hover {
  background: #dc2626;
}

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

/* ========== PRODUCT DETAIL MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gray-light);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.modal-img {
  background: var(--gray-light);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info {
  padding: 2rem;
}

.modal-info h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1rem 0;
}

.modal-desc {
  color: var(--gray);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.modal-features {
  list-style: none;
  margin-bottom: 1.5rem;
}

.modal-features li {
  padding: 0.3rem 0;
  padding-left: 1.4rem;
  position: relative;
}

.modal-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

/* ========== ADMIN ========== */
.admin-wrapper {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.2rem;
}

.login-box {
  background: white;
  max-width: 400px;
  margin: 4rem auto;
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-box h2 {
  margin-bottom: 0.5rem;
}

.login-box p {
  color: var(--gray);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.2rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

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

.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.6rem;
}

.admin-actions {
  display: flex;
  gap: 0.8rem;
}

.admin-table-wrapper {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.admin-table th,
.admin-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.admin-table th {
  background: var(--gray-light);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
}

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

.admin-table img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

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

/* Form Modal for Add/Edit */
.form-modal .modal {
  max-width: 560px;
}

.form-modal .modal-content {
  display: block;
  padding: 2rem;
}

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

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

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

/* ========== FOOTER ========== */
.footer {
  background: var(--dark);
  color: white;
  text-align: center;
  padding: 2rem 1.2rem;
  margin-top: 3rem;
}

.footer p {
  opacity: 0.8;
  font-size: 0.95rem;
}

.footer a {
  color: var(--primary-light);
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray);
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--dark);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .modal-content {
    grid-template-columns: 1fr;
  }

  .modal-img {
    min-height: 220px;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .nav {
    gap: 1rem;
  }

  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) {
    display: none;
  }
}

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

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

  .hero {
    padding: 2rem 1rem;
  }
}

/* Utility */
.hidden {
  display: none !important;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
