/* ============================================
   HISPACERÁMICA - Admin Panel Styles
   ============================================ */

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

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--color-text);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.admin-sidebar-header h2 {
  font-family: var(--font-heading);
  color: white;
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.admin-sidebar-header span {
  font-size: 0.8rem;
  opacity: 0.5;
}

.admin-nav {
  list-style: none;
  padding: 1rem 0;
  flex: 1;
}

.admin-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.admin-nav li a:hover,
.admin-nav li a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.admin-nav li a svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

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

.admin-sidebar-footer a {
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-sidebar-footer a:hover {
  color: white;
}

/* Main Content */
.admin-main {
  flex: 1;
  background: var(--color-bg);
  overflow-y: auto;
}

.admin-topbar {
  background: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.admin-topbar h1 {
  font-size: 1.5rem;
}

.admin-content {
  padding: 2rem;
}

/* Stats Cards */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.stat-card-header span {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.stat-card-icon.blue { background: #3B82F6; }
.stat-card-icon.green { background: var(--color-success); }
.stat-card-icon.orange { background: #F59E0B; }
.stat-card-icon.purple { background: #8B5CF6; }

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Tables */
.admin-table-container {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.admin-table-header h3 {
  font-size: 1.1rem;
}

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

.admin-table th {
  text-align: left;
  padding: 0.85rem 1.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-light);
  background: var(--color-bg);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

.admin-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

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

.admin-table tr:hover td {
  background: var(--color-bg);
}

.admin-table .product-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.admin-table .product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.pending { background: #FEF3C7; color: #92400E; }
.status-badge.confirmed { background: #D1FAE5; color: #065F46; }
.status-badge.processing { background: #DBEAFE; color: #1E40AF; }
.status-badge.shipped { background: #E0E7FF; color: #3730A3; }
.status-badge.delivered { background: #D1FAE5; color: #065F46; }
.status-badge.cancelled { background: #FEE2E2; color: #991B1B; }
.status-badge.completed { background: #D1FAE5; color: #065F46; }

/* Admin Modal/Form */
.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

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

.admin-modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.admin-modal-body {
  padding: 1.5rem;
}

.admin-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Image Upload */
.image-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.image-upload-area:hover {
  border-color: var(--color-primary);
  background: var(--color-bg);
}

.image-upload-area svg {
  width: 40px;
  height: 40px;
  fill: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.image-upload-area p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.image-preview {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: var(--color-bg-warm);
  margin-top: 0.5rem;
}

/* Order detail */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.order-detail-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.order-detail-section h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.order-info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.order-info-row .label {
  color: var(--color-text-light);
}

.order-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.order-items-table th {
  text-align: left;
  padding: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
  border-bottom: 1px solid var(--color-border);
}

.order-items-table td {
  padding: 0.5rem;
  font-size: 0.9rem;
}

/* Login Page */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-warm);
}

.admin-login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 3rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.admin-login-card h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.admin-login-card .subtitle {
  color: var(--color-text-light);
  margin-bottom: 2rem;
}

.admin-login-card .form-group {
  text-align: left;
}

.admin-login-card .btn {
  width: 100%;
  margin-top: 0.5rem;
}

.login-error {
  background: #FEE2E2;
  color: #991B1B;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

/* Admin Mobile Menu Button */
.admin-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  flex-shrink: 0;
}

.admin-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  margin: 4px 0;
  transition: all var(--transition);
}

/* Admin Mobile Overlay */
.admin-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

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

/* Responsive Admin */
@media (max-width: 1024px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .order-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-menu-btn {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--transition);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-content {
    padding: 1rem;
  }

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

  .admin-table-container {
    overflow-x: auto;
  }
}
