/* ===== Admin Layout ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--color-dark, #1a1a2e);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.admin-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f4f6f9;
}

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

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

.sidebar-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-logo small {
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
  display: block;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.sidebar-nav a.router-link-active,
.sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-left-color: var(--color-primary, #e8491d);
}

.sidebar-nav .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

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

.sidebar-footer .admin-lang-switcher {
  width: 100%;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius, 6px);
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
}

.sidebar-footer .admin-lang-switcher option {
  color: #333;
  background: #fff;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s;
}

.sidebar-logout:hover {
  color: #fff;
}

/* ===== Top Bar ===== */
.admin-topbar {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar h1 {
  font-size: 1.4rem;
  color: var(--color-dark, #1a1a2e);
  margin: 0;
}

.admin-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-text-light, #666);
  font-size: 0.9rem;
}

.admin-topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary, #e8491d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-dark, #1a1a2e);
  padding: 0.25rem;
}

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

.stat-card {
  background: #fff;
  border-radius: var(--radius, 6px);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 4px solid var(--color-primary, #e8491d);
}

.stat-card-label {
  font-size: 0.85rem;
  color: var(--color-text-light, #666);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-dark, #1a1a2e);
}

.stat-card:nth-child(2) { border-left-color: #f59e0b; }
.stat-card:nth-child(3) { border-left-color: #10b981; }
.stat-card:nth-child(4) { border-left-color: #3b82f6; }

/* ===== Admin Cards / Sections ===== */
.admin-card {
  background: #fff;
  border-radius: var(--radius, 6px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}

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

.admin-card-header h2 {
  font-size: 1.1rem;
  color: var(--color-dark, #1a1a2e);
  margin: 0;
}

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

/* ===== Data Tables ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light, #666);
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.95rem;
  color: var(--color-text, #333);
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

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

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

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

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

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

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: nowrap;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.filter-icon {
  font-size: 0.95rem;
  color: var(--color-text-light, #666);
  flex-shrink: 0;
  user-select: none;
}

.filter-bar .form-control {
  max-width: 200px;
}

.filter-bar select.form-control {
  max-width: 170px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.9rem;
  color: var(--color-text-light, #666);
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

.pagination-buttons button {
  padding: 0.4rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius, 6px);
  background: #fff;
  color: var(--color-text, #333);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.pagination-buttons button:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.pagination-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Detail Page Layout ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.detail-info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.detail-info-label {
  font-size: 0.85rem;
  color: var(--color-text-light, #666);
}

.detail-info-value {
  font-weight: 600;
  color: var(--color-dark, #1a1a2e);
}

/* ===== Action Buttons ===== */
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius, 6px);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

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

.btn-success {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius, 6px);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

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

/* ===== Alert within admin ===== */
.admin-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius, 6px);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.admin-alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.admin-alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-light, #666);
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* ===== Loading ===== */
.admin-loading {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-light, #666);
  font-size: 1rem;
}

/* ===== Mobile Overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

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

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

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-overlay.open {
    display: block;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-content {
    padding: 1rem;
  }

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

  .mobile-menu-toggle {
    display: block;
  }

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

  .filter-bar {
    flex-wrap: wrap;
  }

  .filter-item {
    flex-shrink: 1;
  }

  .filter-bar .form-control,
  .filter-bar select.form-control {
    max-width: none;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
  }
}

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

/* ===== Spinner ===== */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--color-border, #e2e8f0);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Page Transitions ===== */
.page-enter-active,
.page-leave-active {
  transition: opacity 0.25s ease;
}
.page-enter-from {
  opacity: 0;
}
.page-leave-to {
  opacity: 0;
}

/* ===== Dark Theme - Admin Overrides ===== */
.admin-theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius, 6px);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.admin-theme-toggle:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

[data-theme="dark"] .admin-sidebar {
  background: #111111;
}

[data-theme="dark"] .admin-main {
  background: #0d0d0d;
}

[data-theme="dark"] .admin-topbar {
  background: #1e1e1e;
  border-bottom-color: #333;
}

[data-theme="dark"] .admin-topbar h1 {
  color: #e0e0e0;
}

[data-theme="dark"] .admin-card {
  background: #1e1e1e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .admin-card-header {
  border-bottom-color: #333;
}

[data-theme="dark"] .admin-card-header h2 {
  color: #e0e0e0;
}

[data-theme="dark"] .stat-card {
  background: #1e1e1e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .stat-card-value {
  color: #e0e0e0;
}

[data-theme="dark"] .admin-table th {
  border-bottom-color: #444;
}

[data-theme="dark"] .admin-table td {
  border-bottom-color: #2a2a2a;
  color: #d0d0d0;
}

[data-theme="dark"] .admin-table tbody tr:hover {
  background: #252525;
}

[data-theme="dark"] .pagination {
  border-top-color: #333;
}

[data-theme="dark"] .pagination-buttons button {
  background: #1e1e1e;
  border-color: #444;
  color: #d0d0d0;
}

[data-theme="dark"] .pagination-buttons button:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #555;
}

[data-theme="dark"] .detail-info-row {
  border-bottom-color: #2a2a2a;
}

[data-theme="dark"] .detail-info-value {
  color: #e0e0e0;
}

[data-theme="dark"] .admin-alert-success {
  background: #0f2e1a;
  color: #34d399;
  border-color: #1a4a2e;
}

[data-theme="dark"] .admin-alert-error {
  background: #3b1414;
  color: #f87171;
  border-color: #5c2020;
}

[data-theme="dark"] .status-badge.status-pending { background: #4a3c00; color: #fbbf24; }
[data-theme="dark"] .status-badge.status-processing { background: #002952; color: #60a5fa; }
[data-theme="dark"] .status-badge.status-completed { background: #003d1a; color: #34d399; }

[data-theme="dark"] .sidebar-overlay.open {
  background: rgba(0,0,0,0.7);
}

/* ===== Quote Action Panels ===== */
.quote-action-warning { background: #fff3cd; border-radius: 0.5rem; margin-bottom: 1.5rem; padding: 1rem; }
.quote-action-danger  { background: #fff0f0; border-radius: 0.5rem; margin-bottom: 1.5rem; padding: 1rem; }
[data-theme="dark"] .quote-action-warning { background: #2e2600; }
[data-theme="dark"] .quote-action-danger  { background: #2e1010; }

/* ===== Quote Status Badges ===== */
.status-badge.status-quote-pending  { background: #fef3c7; color: #92400e; }
.status-badge.status-awaiting-payment { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .status-badge.status-quote-pending  { background: #4a3c00; color: #fbbf24; }
[data-theme="dark"] .status-badge.status-awaiting-payment { background: #002952; color: #60a5fa; }

/* ===== Modal Transition ===== */
.modal-fade-enter-active,
.modal-fade-leave-active { transition: opacity 0.2s ease; }
.modal-fade-enter-active .upload-modal,
.modal-fade-leave-active .upload-modal { transition: opacity 0.2s ease, transform 0.2s ease; }
.modal-fade-enter-from,
.modal-fade-leave-to { opacity: 0; }
.modal-fade-enter-from .upload-modal,
.modal-fade-leave-to .upload-modal { opacity: 0; transform: scale(0.96); }

/* ===== Files Modal ===== */
.upload-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.upload-modal {
  background: var(--color-bg, #fff); border-radius: var(--radius, 6px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2); width: 100%; max-width: 600px; max-height: 80vh;
  display: flex; flex-direction: column;
}
.upload-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid #e2e8f0; flex-shrink: 0;
}
.upload-modal-header h3 { margin: 0; color: var(--color-primary, #e8491d); }
.upload-modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--color-text-light, #666); line-height: 1; padding: 0;
}
.upload-modal-close:hover { color: var(--color-text, #333); }
.upload-modal-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.upload-file-list { margin: 0; }
.upload-file-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0; border-bottom: 1px solid #e2e8f0;
}
.upload-file-item:last-child { border-bottom: none; }
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-name {
  display: block; font-size: 0.9rem; word-break: break-all;
  color: var(--color-text, #333);
}
.upload-modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-top: 1px solid #e2e8f0; flex-shrink: 0;
}
.upload-modal-count { font-size: 0.9rem; color: var(--color-text-light, #666); }
[data-theme="dark"] .upload-modal { background: #1e1e1e; }
[data-theme="dark"] .upload-modal-header,
[data-theme="dark"] .upload-file-item,
[data-theme="dark"] .upload-modal-footer { border-color: #333; }

.modal-dir-path {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--color-bg-secondary, #f1f5f9);
  border-radius: var(--radius, 6px);
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--color-text-light, #64748b);
  word-break: break-all;
}
[data-theme="dark"] .modal-dir-path {
  background: #252525;
  color: #999;
}

/* ===== Back Icon Button ===== */
.back-icon-btn {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-light, #64748b);
  font-size: 1.6rem;
  text-decoration: none;
  line-height: 1;
  transition: color 0.15s;
}
.back-icon-btn:hover { color: var(--color-primary, #e8491d); }
