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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #FFD700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.header {
  background: #FFD700;
  border-bottom: none;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.15);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.8em;
  color: #1a1a1a;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-nav a {
  margin-left: 20px;
  color: #555;
}

.header-nav a:hover {
  color: #FFD700;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 11px 24px;
  border: none;
  border-radius: 6px;
  font-size: 0.95em;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: left 0.3s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: #FFD700;
  color: #1a1a1a;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  text-decoration: none;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

.btn-secondary {
  background-color: white;
  color: #333;
  border: 2px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background-color: #f5f7fa;
  border-color: #FFD700;
  color: #FFD700;
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.btn-danger {
  background: #d9534f;
  color: white;
  box-shadow: 0 4px 15px rgba(217, 83, 79, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217, 83, 79, 0.4);
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85em;
}

.btn-block {
  display: block;
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #1a1a1a;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95em;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #FFD700;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

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

/* Search Container */
.search-container {
  margin-bottom: 30px;
}

.search-container form {
  background: white;
  padding: 16px;
  border-radius: 10px;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.search-container input[type="text"] {
  padding: 10px;
  font-size: 0.95em;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}

.view-btn {
  background: white;
  border: 2px solid #ddd;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: #666;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  border-color: #FFD700;
  color: #FFD700;
}

.view-btn.active {
  background-color: #FFD700;
  border-color: #FFD700;
  color: #1a1a1a;
}

.view-btn svg {
  width: 20px;
  height: 20px;
}

/* Categories */
.category-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.category-btn {
  padding: 10px 20px;
  border: 2px solid #e5e5e5;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 215, 0, 0.1);
  transition: left 0.3s ease;
}

.category-btn:hover::before {
  left: 100%;
}

.category-btn:hover {
  border-color: #FFD700;
  color: #FFD700;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.category-btn.active {
  background: #FFD700;
  color: #1a1a1a;
  border-color: #FFD700;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

/* Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.product-card {
  background: white;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  position: relative;
  animation: slideInUp 0.5s ease-out;
}

.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(n+6) { animation-delay: 0.3s; }

.product-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #FFD700;
  transform: scaleX(0);
  transition: transform 0.4s ease;
  transform-origin: left;
}

.product-card:hover::after {
  transform: scaleX(1);
}

.product-card:hover {
  box-shadow: 0 12px 40px rgba(255, 215, 0, 0.2);
  transform: translateY(-8px);
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.product-card:hover .product-image {
  transform: scale(1.08);
}

.product-info {
  padding: 15px;
}

.product-category {
  display: inline-block;
  background: #FFD700;
  color: #FFD700;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75em;
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 215, 0, 0.2);
}

.product-name {
  font-size: 1.15em;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 10px;
  line-height: 1.4;
}

.product-price {
  font-size: 1.5em;
  color: #FFD700;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.product-stock {
  font-size: 0.85em;
  margin-bottom: 12px;
  font-weight: 600;
}

.stock-available {
  color: #1a9e6f;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stock-unavailable {
  color: #d9534f;
  font-weight: 700;
}

/* Product Detail */
.product-detail {
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  animation: slideInUp 0.6s ease-out;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-image {
  width: 100%;
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.15);
  transition: transform 0.4s ease;
}

.product-gallery:hover .main-image {
  transform: scale(1.02);
}

.thumbnail-gallery {
  display: flex;
  gap: 12px;
}

.thumbnail {
  width: 70px;
  height: 70px;
  border: 3px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  object-fit: cover;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumbnail:hover {
  transform: translateY(-2px);
  border-color: #FFD700;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.thumbnail.active {
  border-color: #FFD700;
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.3);
  transform: scale(1.05);
}

.product-details h1 {
  font-size: 2em;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.detail-category {
  display: inline-block;
  background-color: #f0f0f0;
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 0.9em;
  color: #666;
  margin-bottom: 15px;
}

.detail-price {
  font-size: 2em;
  color: #FFD700;
  font-weight: 700;
  margin-bottom: 15px;
}

.detail-stock {
  font-size: 1.1em;
  margin-bottom: 20px;
}

.detail-description {
  color: #555;
  line-height: 1.8;
  margin-bottom: 25px;
  white-space: pre-wrap;
}

/* Admin */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.admin-header h2 {
  font-size: 1.8em;
  color: #1a1a1a;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.admin-table th {
  background: #FFD700;
  padding: 14px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid #e5e5e5;
  color: #1a1a1a;
  letter-spacing: 0.3px;
}

.admin-table td {
  padding: 14px;
  border-bottom: 1px solid #e5e5e5;
  transition: all 0.3s ease;
}

.admin-table tr:hover {
  background-color: rgba(255, 215, 0, 0.02);
}

.admin-table tr:hover td {
  color: #FFD700;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-form {
  background: white;
  padding: 25px;
  border-radius: 4px;
  max-width: 600px;
}

.admin-form h2 {
  font-size: 1.5em;
  margin-bottom: 20px;
  color: #1a1a1a;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

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

/* Image Upload */
.image-upload-group {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #fafbfc;
  border-radius: 4px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.image-preview {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  border-radius: 4px;
  background-color: #e5e5e5;
}

.image-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.delete-image-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #d9534f;
  color: white;
  border: none;
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
}

.delete-image-btn:hover {
  background-color: #c9302c;
}

/* Login */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #FFD700;
}

.login-form {
  background: white;
  padding: 45px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 380px;
  position: relative;
  overflow: hidden;
}

.login-form::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: #FFD700;
  animation: gradient-shift 15s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}

.login-form h1 {
  font-size: 2em;
  margin-bottom: 30px;
  text-align: center;
  color: #1a1a1a;
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.login-form .form-group {
  margin-bottom: 15px;
}

/* List View */
.product-list {
  background: white;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
}

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

.product-table th {
  background-color: #f8f9fa;
  padding: 15px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e5e5e5;
  color: #1a1a1a;
}

.product-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #e5e5e5;
  vertical-align: middle;
}

.product-table tr:hover {
  background-color: #fafbfc;
}

.list-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 3px;
}

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

/* Messages */
.alert {
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

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

/* Analytics Dashboard */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

.stat-card > div:first-child {
  font-size: 0.85em;
  color: #999;
  margin-bottom: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.stat-card > div:last-child {
  font-size: 2.2em;
  font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
  .analytics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .header-container {
    flex-direction: column;
    gap: 15px;
  }

  .category-filters {
    flex-direction: column;
  }

  .category-btn {
    width: 100%;
  }

  .search-container form {
    flex-direction: column;
  }

  .search-container input,
  .search-container button,
  .search-container a {
    width: 100%;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .product-table th,
  .product-table td {
    padding: 10px;
    font-size: 0.9em;
  }

  .list-thumb {
    width: 50px;
    height: 50px;
  }

  .admin-table {
    font-size: 0.9em;
  }

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

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

  .login-form {
    padding: 25px;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  padding: 16px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
  font-size: 0.95em;
  line-height: 1.4;
}

.toast.success {
  background: #1a9e6f;
  color: white;
}

.toast.success::before {
  content: "✓";
  font-weight: bold;
  font-size: 1.2em;
  flex-shrink: 0;
}

.toast.error {
  background: #d9534f;
  color: white;
}

.toast.error::before {
  content: "✕";
  font-weight: bold;
  font-size: 1.2em;
  flex-shrink: 0;
}

.toast.info {
  background: #0083B0;
  color: white;
}

.toast.info::before {
  content: "ℹ";
  font-weight: bold;
  font-size: 1.2em;
  flex-shrink: 0;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast.removing {
  animation: slideOut 0.3s ease-out forwards;
}
