/* Modern Design System - Dark & Light Mode Glassmorphism Theme */
:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-color: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* YouTube-style Skeleton Loader Overlay */
#pageSkeletonOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0f172a;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#pageSkeletonOverlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.15) 37%, rgba(255, 255, 255, 0.04) 63%);
  background-size: 400% 100%;
  animation: skeletonShimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.skeleton-nav {
  height: 50px;
  margin-bottom: 2rem;
  border-radius: var(--radius-md);
}

.skeleton-hero {
  height: 90px;
  width: 60%;
  margin: 0 auto 2rem auto;
  border-radius: var(--radius-md);
}

.skeleton-card {
  height: 120px;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
}

.skeleton-table-row {
  height: 48px;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
}

/* Header Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
}

/* Main Container */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Cards & Glassmorphism */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  position: relative;
}

/* Search Bar Component */
.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto 2rem auto;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  font-size: 1rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Seller Grid / List */
.seller-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.seller-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.seller-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.seller-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.seller-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Quotation Header Card */
.quote-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

/* 6-Column Quotation Table */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  margin-bottom: 1rem;
}

.quote-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

.quote-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 0.85rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.quote-table td {
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  position: relative;
}

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

.input-field,
.select-field {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.input-field:focus,
.select-field:focus {
  border-color: var(--accent-primary);
}

/* Single-Bar Searchable Combobox Component */
.combobox-container {
  position: relative;
  width: 100%;
}

.combobox-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.combobox-input {
  width: 100%;
  padding-right: 2.2rem !important;
  cursor: pointer;
}

.combobox-arrow {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.combobox-container.open .combobox-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  width: 100%;
  max-width: 380px;
  background: #1e293b;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
  z-index: 9999;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.combobox-container.open .combobox-dropdown {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

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

.combobox-search-header {
  padding: 0.35rem 0.35rem 0.5rem 0.35rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.4rem;
  position: sticky;
  top: 0;
  background: #1e293b;
  z-index: 10;
}

.combobox-search-field {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.combobox-item {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.15s ease;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.combobox-item:hover,
.combobox-item.selected {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

.combobox-item .item-rate-tag {
  font-weight: 700;
  color: var(--accent-success);
  font-size: 0.8rem;
  background: rgba(16, 185, 129, 0.15);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* Remove up/down spinner arrows on number inputs */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* High contrast clear text for read-only and disabled input fields */
.input-field:read-only,
.input-field:disabled {
  background: rgba(30, 41, 59, 0.85) !important;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  opacity: 1 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.total-input {
  color: #10b981 !important;
  -webkit-text-fill-color: #10b981 !important;
  font-weight: 700 !important;
}

/* Table Footer / Grand Total */
.grand-total-row {
  background: rgba(99, 102, 241, 0.15) !important;
  font-weight: 700;
}

.grand-total-label {
  text-align: right;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.grand-total-value {
  font-size: 1.2rem;
  color: var(--accent-success);
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Admin Tabs & Modals */
.tab-container {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  white-space: nowrap;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--accent-success);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* MOBILE & TABLET RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) {
  .navbar {
    padding: 1rem;
  }

  .nav-brand {
    font-size: 1.2rem;
  }

  .container {
    padding: 0 1rem;
    margin: 1.25rem auto;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .card {
    padding: 1.1rem;
    margin-bottom: 1.25rem;
  }

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

  .action-bar {
    flex-direction: column;
    width: 100%;
  }

  .action-bar .btn {
    width: 100%;
    justify-content: center;
  }

  .quote-header-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 480px) {
  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .tab-btn {
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
  }

  .search-input {
    font-size: 0.9rem;
    padding: 0.85rem 1rem 0.85rem 2.6rem;
  }

  .search-icon {
    left: 0.85rem;
    width: 18px;
    height: 18px;
  }
}