/* Professional Medical Software Layout */

/* ========================================
   MODAL STYLES
   ======================================== */

/* Modal Base */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
}

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

/* Modal Content */
.modal-content {
  background: var(--bg-main);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

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

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Close Button - Professional Style */
.close-btn {
  background: transparent;
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.close-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: rotate(90deg);
}

.close-btn:active {
  transform: rotate(90deg) scale(0.95);
}

[data-theme="dark"] .close-btn:hover {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fca5a5;
}

/* Modal Body */
.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

/* Modal Footer (if needed) */
.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 28px;
  border-top: 2px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

/* Dark Theme Modal Adjustments */
[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-content {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ========================================
   END MODAL STYLES
   ======================================== */

:root {
  /* Professional Medical Colors */
  --med-navy: #0f172a;
  --med-slate: #1e293b;
  --med-blue: #2563eb;
  --med-blue-dark: #1e40af;
  --med-teal: #0891b2;
  --med-teal-dark: #0e7490;
  
  /* Light Theme */
  --bg-main: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  
  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f8fafc;
  
  /* Header */
  --header-height: 70px;
  --header-bg: #ffffff;
  
  /* Professional Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  display: flex;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(15, 23, 42, 0.95);
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--med-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.loading-text {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.3px;
}


[data-theme="dark"] {
  /* Dark Theme - Professional Medical */
  --bg-main: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border-color: #334155;
  --border-hover: #475569;
  
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --header-bg: #1e293b;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.2s ease;
}

/* Hide content by default to prevent flash before auth check */
body:not(.app-ready) #adminView,
body:not(.app-ready) #viewerView {
  display: none !important;
  visibility: hidden;
  opacity: 0;
}

/* Professional Header */
.professional-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--med-blue);
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-search {
  position: relative;
  width: 400px;
}

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
}

.header-search input:focus {
  outline: none;
  border-color: var(--med-blue);
  background: var(--bg-main);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.icon-btn i {
  width: 20px;
  height: 20px;
}

.mode-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.mode-indicator i {
  width: 16px;
  height: 16px;
}

/* Main Layout Container */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-height);
}

/* Professional Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 100;
}

.sidebar-section {
  padding: 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  padding: 0 12px;
}

.category-list {
  list-style: none;
}

.category-item {
  margin-bottom: 4px;
}

.category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.category-btn:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.category-btn.active {
  background: var(--med-blue);
  color: white;
}

.category-btn i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.category-count {
  margin-left: auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.category-btn.active .category-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  background: var(--bg-secondary);
  min-height: calc(100vh - var(--header-height));
}

.content-wrapper {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.content-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.content-actions {
  display: flex;
  gap: 12px;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--med-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--med-blue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary i {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-main);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
}

.product-card:hover {
  border-color: var(--med-blue);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  height: 200px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.product-image-placeholder i {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

.product-info {
  padding: 16px;
}

.product-category-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--med-blue);
}

.product-id {
  font-size: 12px;
  color: var(--text-tertiary);
}

.product-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.btn-small {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
}

.btn-small:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-small.primary {
  background: var(--med-blue);
  border-color: var(--med-blue);
  color: white;
}

.btn-small.primary:hover {
  background: var(--med-blue-dark);
}

.btn-small i {
  width: 14px;
  height: 14px;
}

/* Professional Footer */
.professional-footer {
  background: var(--header-bg);
  border-top: 1px solid var(--border-color);
  margin-left: var(--sidebar-width);
}

.footer-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
}

.footer-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-section p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.footer-section a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: var(--med-blue);
}

.footer-bottom {
  padding: 20px 32px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Admin Panel Specific */
.admin-form {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--med-blue);
  background: var(--bg-main);
}

/* Sticky Selected Items Button */
.sticky-selected-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--med-blue);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-2xl);
  z-index: 999;
  transition: all 0.3s ease;
}

.sticky-selected-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.3);
  background: var(--med-blue-dark);
}

.sticky-selected-btn i {
  width: 20px;
  height: 20px;
}

.selected-count {
  background: rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content,
  .professional-footer {
    margin-left: 0;
  }
  
  .header-search {
    width: 200px;
  }
  
  .sticky-selected-btn {
    bottom: 20px;
    right: 20px;
    padding: 14px 20px;
  }
}

@media (max-width: 768px) {
  /* Mobile Header Fixes */
  .professional-header {
    padding: 0 12px;
    height: 60px;
  }
  
  .header-left {
    gap: 8px;
    flex: 1;
    min-width: 0; /* Allow text truncation */
  }
  
  .logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }
  
  .header-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .header-right {
    gap: 8px;
    flex-shrink: 0;
  }
  
  .header-icon {
    width: 20px;
    height: 20px;
  }
  
  .mode-badge {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .header-search {
    display: none;
  }
  
  .sidebar {
    width: 100%;
    max-width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  /* Mobile Product Detail Modal */
  .product-detail-grid {
    grid-template-columns: 1fr !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
  }
  
  .product-detail-image-section {
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 24px !important;
    min-height: auto !important;
    max-height: 200px !important;
  }
  
  .product-detail-image-section img {
    max-height: 200px !important;
  }
  
  /* Compact "No Image" placeholder on mobile */
  .product-detail-image-section > div {
    min-height: 120px !important;
    height: 120px !important;
  }
  
  .product-detail-info-section {
    padding: 24px !important;
  }
  
  .modal-content {
    max-width: 95% !important;
    margin: 10px !important;
  }
}

/* Extra Small Mobile (phones < 400px) */
@media (max-width: 400px) {
  .professional-header {
    padding: 0 8px !important;
  }
  
  .header-title {
    font-size: 11px !important;
    max-width: 160px; /* Force truncation on very small screens */
  }
  
  .logo-icon {
    width: 24px !important;
    height: 24px !important;
  }
  
  .header-icon {
    width: 18px !important;
    height: 18px !important;
  }
  
  .mode-badge {
    font-size: 10px !important;
    padding: 3px 6px !important;
  }
}

/* Hospital Info Form Styling */
.hospital-info-container {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(20, 184, 166, 0.04) 100%),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="800" height="400" viewBox="0 0 800 400"><defs><pattern id="medicalPattern" x="0" y="0" width="400" height="400" patternUnits="userSpaceOnUse"><g opacity="0.04"><line x1="200" y1="80" x2="200" y2="320" stroke="%2314b8a6" stroke-width="12" stroke-linecap="round"/><circle cx="200" cy="70" r="15" fill="%2314b8a6"/><path d="M 180 100 Q 170 120, 180 140 Q 190 160, 180 180 Q 170 200, 180 220 Q 190 240, 180 260 Q 170 280, 180 300" fill="none" stroke="%23ef4444" stroke-width="8"/><circle cx="180" cy="100" r="6" fill="%23ef4444"/><ellipse cx="185" cy="110" rx="8" ry="5" fill="%23ef4444" opacity="0.6"/><path d="M 220 120 Q 210 140, 220 160 Q 230 180, 220 200 Q 210 220, 220 240 Q 230 260, 220 280" fill="none" stroke="%23ef4444" stroke-width="8"/><circle cx="220" cy="120" r="6" fill="%23ef4444"/><ellipse cx="215" cy="130" rx="8" ry="5" fill="%23ef4444" opacity="0.6"/><path d="M80 150 L100 150 L100 130 L120 130 L120 150 L140 150 L140 170 L120 170 L120 190 L100 190 L100 170 L80 170 Z" fill="%23ef4444"/><path d="M260 200 L280 200 L280 180 L300 180 L300 200 L320 200 L320 220 L300 220 L300 240 L280 240 L280 220 L260 220 Z" fill="%23ef4444"/></g></pattern></defs><rect width="800" height="400" fill="url(%23medicalPattern)"/></svg>');
    background-size: cover;
    background-position: center;
    background-repeat: repeat;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .hospital-info-container {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(20, 184, 166, 0.06) 100%),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="800" height="400" viewBox="0 0 800 400"><defs><pattern id="medicalPatternDark" x="0" y="0" width="400" height="400" patternUnits="userSpaceOnUse"><g opacity="0.06"><line x1="200" y1="80" x2="200" y2="320" stroke="%2314b8a6" stroke-width="12" stroke-linecap="round"/><circle cx="200" cy="70" r="15" fill="%2314b8a6"/><path d="M 180 100 Q 170 120, 180 140 Q 190 160, 180 180 Q 170 200, 180 220 Q 190 240, 180 260 Q 170 280, 180 300" fill="none" stroke="%23fca5a5" stroke-width="8"/><circle cx="180" cy="100" r="6" fill="%23fca5a5"/><ellipse cx="185" cy="110" rx="8" ry="5" fill="%23fca5a5" opacity="0.6"/><path d="M 220 120 Q 210 140, 220 160 Q 230 180, 220 200 Q 210 220, 220 240 Q 230 260, 220 280" fill="none" stroke="%23fca5a5" stroke-width="8"/><circle cx="220" cy="120" r="6" fill="%23fca5a5"/><ellipse cx="215" cy="130" rx="8" ry="5" fill="%23fca5a5" opacity="0.6"/><path d="M80 150 L100 150 L100 130 L120 130 L120 150 L140 150 L140 170 L120 170 L120 190 L100 190 L100 170 L80 170 Z" fill="%23fca5a5"/><path d="M260 200 L280 200 L280 180 L300 180 L300 200 L320 200 L320 220 L300 220 L300 240 L280 240 L280 220 L260 220 Z" fill="%23fca5a5"/></g></pattern></defs><rect width="800" height="400" fill="url(%23medicalPatternDark)"/></svg>');
    background-size: cover;
    background-position: center;
    background-repeat: repeat;
    border-color: rgba(37, 99, 235, 0.3);
}

.hospital-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.hospital-alert-icon {
    width: 24px;
    height: 24px;
    color: var(--med-blue);
    flex-shrink: 0;
}

.hospital-info-title {
    margin: 0;
    color: var(--med-blue);
    font-size: 18px;
    font-weight: 700;
}

.hospital-info-subtitle {
    margin: 0 0 20px 36px;
    color: var(--text-secondary);
    font-size: 14px;
}

.hospital-field-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 14px;
}

.required-star {
    color: #ef4444;
}

[data-theme="dark"] .required-star {
    color: #fca5a5;
}

.hospital-input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.hospital-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .hospital-input {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .hospital-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.hospital-hint {
    color: var(--text-secondary);
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

.hospital-error {
    color: #ef4444;
    font-size: 12px;
    display: none;
    margin-top: 4px;
}

[data-theme="dark"] .hospital-error {
    color: #fca5a5;
}

.hospital-status-warning {
    margin-top: 16px;
    padding: 12px;
    background: rgba(254, 242, 242, 0.8);
    border-radius: 8px;
    border: 1px solid #fecaca;
    display: none;
    align-items: center;
    gap: 8px;
    color: #991b1b;
    font-size: 14px;
    font-weight: 600;
}

[data-theme="dark"] .hospital-status-warning {
    background: rgba(127, 29, 29, 0.3);
    border-color: rgba(252, 165, 165, 0.3);
    color: #fca5a5;
}

/* ============================================
   LIST MODE STYLES
   ============================================ */

/* List View Container */
.products-list {
    width: 100%;
    background: var(--bg-main);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    grid-column: 1 / -1; /* Span all grid columns */
}

/* List Table */
.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table thead {
    background: linear-gradient(135deg, var(--med-blue) 0%, var(--med-teal) 100%);
    color: white;
}

.products-table th {
    padding: 16px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.products-table th:first-child {
    padding-left: 20px;
}

.products-table th:last-child {
    padding-right: 20px;
}

.products-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.products-table tbody tr:hover {
    background: var(--bg-secondary);
}

.products-table tbody tr:last-child {
    border-bottom: none;
}

.products-table td {
    padding: 16px 12px;
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.products-table td:first-child {
    padding-left: 20px;
}

.products-table td:last-child {
    padding-right: 20px;
}

/* List Item Number */
.list-item-no {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 13px;
}

/* List Image Thumbnail */
.list-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.list-image-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
}

.list-image-placeholder i {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* List Product Name */
.list-product-name {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.2s;
}

.list-product-name:hover {
    color: var(--med-blue);
}

/* List Category Badge */
.list-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* List Prices */
.list-price {
    font-weight: 700;
    color: var(--med-blue);
    font-size: 15px;
}

.list-prices-admin {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.list-price-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    min-width: 60px;
}

.list-price-value {
    font-weight: 700;
    font-size: 14px;
}

.list-price-value.admin-price {
    color: var(--med-blue);
}

.list-price-value.doctor-price {
    color: #14b8a6;
}

.list-price-value.wholesale-price {
    color: #8b5cf6;
}

/* List Actions */
.list-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.list-actions .btn-small {
    font-size: 12px;
    padding: 6px 12px;
}

/* Mobile Responsive */
@media (max-width: 1200px) {
    .products-table th,
    .products-table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .list-image,
    .list-image-placeholder {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .products-list {
        overflow-x: auto;
    }
    
    .products-table {
        min-width: 800px;
    }
    
    .products-table th,
    .products-table td {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .list-image,
    .list-image-placeholder {
        width: 35px;
        height: 35px;
    }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .products-table tbody tr:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .list-category {
    background: var(--bg-tertiary);
}

/* Invoice Manager Styles */
.invoice-search-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.invoice-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.invoice-card {
  transition: all 0.2s ease;
}

.invoice-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.history-item {
  position: relative;
}

.history-item:last-child {
  padding-bottom: 0;
}

.revision-item {
  transition: all 0.2s ease;
}

.revision-item:hover {
  background: var(--bg-tertiary) !important;
}

/* Invoice Modal Enhancements */
#invoiceModal .modal-content,
#invoiceHistoryModal .modal-content,
#revisionModal .modal-content {
  animation: slideDown 0.3s ease;
}

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

/* Invoice Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-active {
  background: #27ae6020;
  color: #27ae60;
}

.status-revised {
  background: #f39c1220;
  color: #f39c12;
}

.status-cancelled {
  background: #95a5a620;
  color: #95a5a6;
}

/* Invoice History Tree */
.invoice-history-tree {
  padding: 20px 0;
}

.invoice-history-tree .history-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: -8px;
  width: 2px;
  background: var(--border-color);
}

.invoice-history-tree .history-item:last-child::before {
  display: none;
}

/* Responsive Invoice Styles */
@media (max-width: 768px) {
  .invoice-search-bar {
    flex-direction: column;
  }
  
  .invoice-search-bar input {
    width: 100%;
  }
  
  .invoice-card {
    padding: 16px !important;
  }
  
  .invoice-card h3 {
    font-size: 16px !important;
  }
  
  .revision-item {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  
  .revision-item > div {
    width: 100% !important;
  }
}

/* Product Selector Modal */
#productSelectorModal .modal-content {
  animation: slideUp 0.3s ease;
}

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

.product-selector-card {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#productSelectorGrid::-webkit-scrollbar {
  width: 8px;
}

#productSelectorGrid::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

#productSelectorGrid::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

#productSelectorGrid::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Product Selector Search Input Icon */
#productSelectorModal input[type="text"] {
  transition: all 0.2s ease;
}

#productSelectorModal input[type="text"]:focus {
  outline: none;
  border-color: var(--med-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#productSelectorModal select {
  transition: all 0.2s ease;
  cursor: pointer;
}

#productSelectorModal select:focus {
  outline: none;
  border-color: var(--med-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive Product Selector */
@media (max-width: 768px) {
  #productSelectorGrid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 12px !important;
  }
  
  .product-selector-card {
    padding: 10px !important;
  }
  
  #productSelectorModal .modal-content {
    max-width: 95% !important;
    margin: 10px;
  }
}
