/* ==========================================================================
   OPTICLES REUSABLE COMPONENTS & MICRO-INTERACTIONS
   ========================================================================== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  transition: all var(--transition-normal);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  transition: width var(--transition-normal);
  pointer-events: none;
}
.btn:hover::before {
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary, .btn-dark {
  background: linear-gradient(135deg, var(--color-brand-blue) 0%, var(--color-brand-blue-dark) 100%);
  color: var(--color-text-white);
  border-color: var(--color-brand-blue-dark);
}
.btn-primary:hover, .btn-dark:hover {
  background: linear-gradient(135deg, var(--color-brand-blue-hover) 0%, var(--color-brand-blue) 100%);
  color: var(--color-text-white);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-gold {
  background: linear-gradient(135deg, #F0C040 0%, #D4AF37 100%);
  color: #1a140c;
  border: none;
  font-weight: 700;
}
.btn-gold:hover {
  background: linear-gradient(135deg, #F4CE5E 0%, #B8952F 100%);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-main);
}
.btn-outline:hover {
  border-color: var(--color-brand-blue);
  background: linear-gradient(135deg, rgba(0, 54, 101, 0.06) 0%, rgba(0, 30, 60, 0.03) 100%);
  transform: translateY(-1px);
}

.btn-outline-gold {
  background-color: transparent;
  border: 1.5px solid var(--color-gold);
  color: var(--color-gold-dark);
}
.btn-outline-gold:hover {
  background-color: var(--color-gold-light);
  border-color: var(--color-gold-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background: var(--color-slate-100);
  color: var(--color-text-main);
}

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  color: var(--color-text-main);
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  background: var(--color-slate-100);
  border-color: var(--color-slate-400);
  transform: scale(1.05);
}
.btn-icon.active {
  background: #FEE2E2;
  border-color: #F87171;
  color: #DC2626;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

.badge-gold {
  background: var(--color-gold-light);
  color: #8c6b3e;
  border: 1px solid rgba(197, 168, 128, 0.4);
}

.badge-new {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-bestseller {
  background: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-sale {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}
.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

/* --- Product Cards --- */
.product-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow: var(--shadow-xl);
  transform: translateY(-6px);
}

.product-thumb-wrap {
  position: relative;
  background: linear-gradient(135deg, #F8F8F9 0%, #F1F5F9 100%);
  padding: var(--space-xl) var(--space-md);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.product-thumb-wrap img {
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-thumb-wrap img {
  transform: scale(1.08);
}

.product-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.product-actions-hover {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2;
  opacity: 0;
  transform: translateX(8px);
  transition: all var(--transition-normal);
}

.product-card:hover .product-actions-hover {
  opacity: 1;
  transform: translateX(0);
}

.product-quick-add {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  z-index: 2;
}

.product-card:hover .product-quick-add {
  transform: translateY(0);
}

.product-details {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-brand {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold-dark);
  margin-bottom: 4px;
}

.product-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.product-title:hover {
  color: var(--color-gold-dark);
}

.product-specs {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}
.product-rating .star {
  color: #F59E0B;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 10px;
}

.product-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-obsidian);
}

.product-mrp {
  font-size: 0.88rem;
  text-decoration: line-through;
  color: var(--color-text-light);
}

.product-discount {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-danger);
}

/* Color Swatches */
.product-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.swatch-dot.active, .swatch-dot:hover {
  transform: scale(1.3);
  box-shadow: 0 0 0 1.5px var(--color-gold);
}

/* --- Form Controls --- */
.form-group {
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg-surface);
  color: var(--color-text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.2);
}

.form-input::placeholder {
  color: var(--color-text-light);
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--color-text-main);
  cursor: pointer;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 14, 23, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

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

.modal-container {
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(12px);
  transition: transform var(--transition-slow);
  overflow: hidden;
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-container.modal-lg {
  max-width: 900px;
}

.modal-container.modal-xl {
  max-width: 1100px;
}

.modal-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-obsidian);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 1.3rem;
  transition: background var(--transition-fast);
}
.modal-close-btn:hover {
  background: var(--color-slate-100);
  color: var(--color-text-main);
}

.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  background-color: var(--color-bg-subtle);
}

/* --- Toast Notification System --- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: linear-gradient(135deg, var(--color-brand-blue) 0%, var(--color-brand-blue-dark) 100%);
  color: var(--color-text-white);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--color-gold);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

/* --- Prescription Specialty Grid --- */
.rx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
}

.rx-table th {
  background: var(--color-slate-100);
  padding: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-slate-700);
  border: 1px solid var(--color-border);
}

.rx-table td {
  padding: 6px;
  border: 1px solid var(--color-border);
}

.rx-table select, .rx-table input {
  width: 100%;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
}

/* --- Floating Prototype Switcher & Demo Banner --- */
.demo-switcher-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(90deg, var(--color-brand-blue-dark) 0%, var(--color-brand-blue) 50%, var(--color-brand-blue-dark) 100%);
  color: #E2E8F0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.4);
}

.demo-switcher-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.demo-pill-badge {
  background: rgba(212, 175, 55, 0.2);
  color: #F0C040;
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.demo-role-nav {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.demo-role-btn {
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: #94A3B8;
  transition: all var(--transition-fast);
}

.demo-role-btn.active {
  background: linear-gradient(135deg, #F0C040 0%, #D4AF37 100%);
  color: #0A0E17;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.demo-switcher-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.demo-action-btn {
  color: #CBD5E1;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}
.demo-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
