/* Admin Panel Custom Styles */

:root {
  --primary-color: #d4527a;
  --primary-hover: #b83d61;
  --sidebar-bg: #1f2937;
  --sidebar-hover: #374151;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f9fafb;
}

/* Sidebar */
.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--sidebar-bg);
  color: white;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.5rem;
  color: #d1d5db;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background: var(--sidebar-hover);
  color: white;
  border-left-color: var(--primary-color);
}

.nav-item i {
  width: 24px;
  margin-right: 12px;
  font-size: 1.125rem;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.75rem 0;
}

.nav-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Main Content */
.admin-main {
  margin-left: 260px;
  min-height: 100vh;
}

.admin-header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-content {
  padding: 2rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
  padding: 0.625rem 1.25rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

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

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

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

.btn-success:hover {
  background: #059669;
}

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

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

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-outline {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
}

.btn-outline:hover {
  background: #f9fafb;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
  font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(212, 82, 122, 0.1);
}

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

.form-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table th {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
}

.data-table tr:hover {
  background: #f9fafb;
}

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

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-secondary {
  background: #f3f4f6;
  color: #374151;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s;
}

.modal {
  background: white;
  border-radius: 0.5rem;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-sm {
  width: 400px;
}

.modal-md {
  width: 600px;
}

.modal-lg {
  width: 800px;
}

.modal-xl {
  width: 1000px;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: slideInRight 0.3s;
  border-left: 4px solid;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-info {
  border-left-color: var(--info);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

.toast-info .toast-icon {
  color: var(--info);
}

/* Image Upload */
.image-upload-container {
  border: 2px dashed #d1d5db;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.image-upload-container:hover {
  border-color: var(--primary-color);
  background: #fef2f5;
}

.image-preview {
  max-width: 200px;
  max-height: 200px;
  margin: 1rem auto;
  border-radius: 0.5rem;
  object-fit: cover;
}

/* Crop Modal */
.imgcrop-stage,
.imgfocal-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.imgcrop-image,
.imgfocal-image {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  border-radius: 0.75rem;
}

.imgcrop-rect {
  position: absolute;
  border: 2px solid var(--primary-color);
  border-radius: 0.5rem;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  cursor: move;
  touch-action: none;
}

.imgcrop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--primary-color);
  border-radius: 4px;
}

.imgcrop-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.imgcrop-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.imgcrop-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.imgcrop-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.imgcrop-focal,
.imgfocal-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #111827;
  border-radius: 9999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.imgcrop-hint,
.imgfocal-hint {
  margin-top: 0.75rem;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Variant Table */
.variant-table {
  width: 100%;
  margin-top: 1rem;
}

/* Login */
.login-body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% 20%, rgba(212, 82, 122, 0.18), transparent 60%),
              radial-gradient(900px 500px at 80% 10%, rgba(59, 130, 246, 0.14), transparent 55%),
              #0b1220;
}

.login-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-bg-shape {
  position: absolute;
  filter: blur(40px);
  opacity: 0.55;
}

.login-bg-shape-1 {
  width: 420px;
  height: 420px;
  left: -120px;
  top: -120px;
  background: rgba(212, 82, 122, 0.55);
  border-radius: 9999px;
}

.login-bg-shape-2 {
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -220px;
  background: rgba(59, 130, 246, 0.45);
  border-radius: 9999px;
}

.login-container {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 1rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
  padding: 1.75rem;
  backdrop-filter: blur(10px);
}

.login-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.login-logo {
  width: 54px;
  height: 54px;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(212, 82, 122, 0.18), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(212, 82, 122, 0.25);
  color: var(--primary-color);
  font-size: 1.5rem;
}

.login-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.login-subtitle {
  margin-top: 0.25rem;
  color: #6b7280;
  font-size: 0.9rem;
}

.login-help {
  margin-top: 0.5rem;
  color: #6b7280;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.login-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.login-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #374151;
  font-size: 0.875rem;
  user-select: none;
  margin: 0.25rem 0 1rem;
}

.login-actions {
  display: grid;
  gap: 0.75rem;
}


.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.login-footer-text {
  color: #6b7280;
  font-size: 0.8125rem;
  font-weight: 600;
}

.login-footer-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.login-alert {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.login-alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.login-alert-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.login-alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #7f1d1d;
}

.login-brand {
  margin-top: 1.25rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8125rem;
}

@media (max-width: 520px) {
  .login-card {
    padding: 1.25rem;
    border-radius: 0.875rem;
  }
  .login-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

.variant-table th {
  background: #f9fafb;
  padding: 0.625rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}

.variant-table td {
  padding: 0.625rem;
  border-bottom: 1px solid #e5e7eb;
}

.variant-table input,
.variant-table select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.variant-row {
  transition: background-color 0.2s;
}

.variant-row:hover {
  background-color: #f9fafb;
}

/* Code Editor Styles */
.code-editor {
  width: 100%;
  min-height: 400px;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #1e1e1e;
  color: #d4d4d4;
  resize: vertical;
}

.code-editor:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(212, 82, 122, 0.1);
}

/* Search and Filter */
.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 250px;
  padding: 0.625rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

/* Loading Spinner */
.spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  
  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .admin-main {
    margin-left: 0;
  }
  
  .admin-content {
    padding: 1rem;
  }
  
  .modal {
    max-width: 95%;
  }
}

/* Child table editor (nested rows) */
.child-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.child-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.child-row .form-input,
.child-row .form-select {
  height: 38px;
}

.child-row .btn {
  height: 38px;
}

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

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

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex {
  display: flex;
}

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

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 1rem;
}

.w-full {
  width: 100%;
}
