/* Common styles shared across ORDER platform pages */

/* ===================================================================
   NEW 14-COLOR DESIGN SYSTEM COMPONENTS
   Updated: November 14, 2025
   Using CSS variables from resi-theme-variables.css
   =================================================================== */

/* === BUTTON COMPONENTS === */

/* Base button styles */
.btn-ds {
  padding: 5.5px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 400;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.5;
  transition: all 0.2s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.btn-ds:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ds:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-ds:focus {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

.btn-ds:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Button Type 1: Primary (Orange - Progressive actions) */
.btn-primary-ds {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}

.btn-primary-ds:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

/* Button Type 1a: Primary Outline (Orange outline - Secondary progressive actions) */
.btn-primary-outline-ds {
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-primary-outline-ds:hover:not(:disabled) {
  background: hsl(22 87% 95%);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
}

body.dark-mode .btn-primary-outline-ds:hover:not(:disabled) {
  background: hsl(22 87% 15%);
}

/* Button Type 2: Secondary (Gray - Safe reversals) */
.btn-secondary-ds {
  background: var(--bg);
  color: var(--secondary);
  border: 1px solid var(--border);
}

.btn-secondary-ds:hover:not(:disabled) {
  background: var(--border-muted);
  border-color: var(--border);
  color: var(--secondary);
}

/* Button Type 3: Tertiary (Indigo - Exploratory actions) */
.btn-tertiary-ds {
  background: hsl(221 39% 46%);
  color: white;
  border: 1px solid hsl(221 39% 46%);
}

.btn-tertiary-ds:hover:not(:disabled) {
  background: hsl(221 39% 40%);
  border-color: hsl(221 39% 40%);
  color: white;
}

body.dark-mode .btn-tertiary-ds:hover:not(:disabled) {
  background: hsl(221 39% 55%);
  border-color: hsl(221 39% 55%);
}

/* Button Type 4: Danger (Red - Destructive actions) */
.btn-danger-ds {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

.btn-danger-ds:hover:not(:disabled) {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
  color: white;
}

/* Button Type 5: Success (Green - Success/Active states) */
.btn-success-ds {
  background: var(--success);
  color: white;
  border: 1px solid var(--success);
}

.btn-success-ds:hover:not(:disabled) {
  background: var(--success-dark);
  border-color: var(--success-dark);
  color: white;
}

.btn-warning-ds {
  background: var(--warning, #f59e0b);
  color: white;
  border: 1px solid var(--warning, #f59e0b);
}

.btn-warning-ds:hover:not(:disabled) {
  background: var(--warning-dark, #d97706);
  border-color: var(--warning-dark, #d97706);
  color: white;
}

/* Button sizes */
.btn-sm-ds {
  padding: 4px 12px;
  font-size: 0.8125rem; /* 13px */
}

.btn-lg-ds {
  padding: 8px 24px;
  font-size: 1rem; /* 16px */
}

/* Button variants with badge styling */
.btn-success-badge-ds {
  background-color: hsl(142 41% 88%);
  color: hsl(142 41% 35%);
  border: 1px solid hsl(142 41% 70%);
}

.btn-success-badge-ds:hover:not(:disabled) {
  background-color: hsl(142 41% 82%);
  border-color: hsl(142 41% 60%);
  color: hsl(142 41% 30%);
}

.btn-danger-badge-ds {
  background-color: hsl(0 50% 88%);
  color: hsl(0 50% 40%);
  border: 1px solid hsl(0 50% 70%);
}

.btn-danger-badge-ds:hover:not(:disabled) {
  background-color: hsl(0 50% 82%);
  border-color: hsl(0 50% 60%);
  color: hsl(0 50% 35%);
}

/* === FLOATING LABEL INPUT COMPONENTS === */
/* Renamed from .input-group to avoid Bootstrap 5 conflicts */
.input-group-ds {
  position: relative;
  margin-bottom: 12px;
}

.input-group-ds input,
.input-group-ds select,
.input-group-ds textarea {
  width: 100%;
  padding: 5.5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  transition: all 0.2s;
  margin-bottom: 0;
}

.input-group-ds input::placeholder {
  color: transparent;
}

/* Hide number input spinners */
.input-group-ds input[type="number"]::-webkit-outer-spin-button,
.input-group-ds input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-group-ds input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.input-group-ds textarea {
  min-height: 100px;
  resize: vertical;
}

.input-group-ds label {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.2s;
  background: var(--bg);
  padding: 0 4px;
}

.input-group-ds textarea + label {
  top: 20px;
  transform: none;
}

.input-group-ds input:focus,
.input-group-ds select:focus,
.input-group-ds textarea:focus {
  outline: none;
  border-color: var(--primary);
  border-width: 1px;
}

.input-group-ds input:focus + label,
.input-group-ds select:focus + label,
.input-group-ds textarea:focus + label,
.input-group-ds input:not(:placeholder-shown) + label,
.input-group-ds select:not([value=""]) + label,
.input-group-ds textarea:not(:placeholder-shown) + label {
  top: -13px;
  left: 10px;
  transform: none;
  font-size: 0.75rem;
  color: var(--primary);
}

/* === STATUS BADGE COMPONENTS === */

.badge-ds {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: capitalize;
}

/* Light mode badges - translucent backgrounds with darker text */
.badge-success-ds {
  background-color: rgba(34, 197, 94, 0.12);
  color: hsl(142 41% 35%);
}

.badge-warning-ds {
  background-color: rgba(245, 158, 11, 0.12);
  color: hsl(38 54% 35%);
}

.badge-danger-ds {
  background-color: rgba(239, 68, 68, 0.12);
  color: hsl(0 50% 40%);
}

.badge-info-ds {
  background-color: rgba(59, 130, 246, 0.12);
  color: hsl(221 39% 38%);
}

.badge-secondary-ds {
  background-color: rgba(107, 114, 128, 0.12);
  color: hsl(220 9% 38%);
}

/* Dark mode badges - translucent neon aesthetic */
body.dark-mode .badge-success-ds {
  background-color: rgba(34, 197, 94, 0.2);
  color: hsl(142 75% 75%);
}

body.dark-mode .badge-warning-ds {
  background-color: rgba(245, 158, 11, 0.2);
  color: hsl(38 80% 75%);
}

body.dark-mode .badge-danger-ds {
  background-color: rgba(239, 68, 68, 0.2);
  color: hsl(0 85% 80%);
}

body.dark-mode .badge-info-ds {
  background-color: rgba(59, 130, 246, 0.2);
  color: hsl(221 75% 75%);
}

body.dark-mode .badge-secondary-ds {
  background-color: rgba(107, 114, 128, 0.2);
  color: hsl(220 10% 75%);
}

/* === CARD COMPONENTS === */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  color: var(--text);
}

/* Add padding only to standalone cards (no header/body children) */
.card:not(:has(.card-header)):not(:has(.card-body)) {
  padding: 12px 16px;  /* Top/bottom 4px less than left/right for compact spacing */
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.card-title,
.card-header {
  color: var(--text);
  padding: 12px 16px !important;  /* Top/bottom 4px less than left/right for compact spacing */
}

.card-body {
  color: var(--text);
}


/* === SECTION TITLE COMPONENTS === */

.section-title {
  font-size: 0.875rem;
  font-weight: 525;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  color: var(--highlight);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-muted);
}

/* Large display number - for statistics */
.heading-display {
  font-size: 1.75rem;
  font-weight: 525;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 0;
}

/* Old ds variant - keeping for backwards compatibility */
.section-title-ds {
  font-size: var(--font-size-xxl);
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border);
}

.section-title-ds-sm {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
}

/* === UTILITY CLASSES === */

.text-ds {
  color: var(--text);
}

.text-muted-ds {
  color: var(--text-muted);
}

/* Text color utilities */
.text-primary-ds {
  color: var(--primary) !important;
}

.text-secondary-ds {
  color: var(--secondary) !important;
}

.text-success-ds {
  color: var(--success) !important;
}

.text-warning-ds {
  color: var(--warning) !important;
}

.text-danger-ds {
  color: var(--danger) !important;
}

.text-info-ds {
  color: var(--info) !important;
}

/* Bootstrap text-muted override for dark mode support */
.text-muted {
  color: var(--text-muted) !important;
}

.bg-ds {
  background: var(--bg);
}

.bg-light-ds {
  background: var(--bg-light);
}

.border-ds {
  border: 1px solid var(--border);
}

/* Background color utilities */
.bg-primary-ds {
  background-color: var(--primary) !important;
  color: white !important;
}

.bg-secondary-ds {
  background-color: var(--secondary) !important;
  color: white !important;
}

.bg-success-ds {
  background-color: var(--success) !important;
  color: white !important;
}

.bg-warning-ds {
  background-color: var(--warning) !important;
  color: var(--text) !important;
}

.bg-danger-ds {
  background-color: var(--danger) !important;
  color: white !important;
}

.bg-info-ds {
  background-color: var(--info) !important;
  color: white !important;
}

/* Card and Modal Headers */
.card-header,
.modal-header {
  border-radius: 6px 6px 0 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* === DARK MODE TOGGLE SWITCH === */

.toggle-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-fixed);
  width: 50px;
  height: 26px;
  background-color: var(--highlight);
  border-radius: 13px;
  cursor: pointer;
  transition: background-color 0.3s;
  box-shadow: var(--shadow-md);
}

.toggle-switch.active {
  background-color: var(--primary);
}

.toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
  transform: translateX(24px);
}

/* === CSP-COMPLIANT DISPLAY UTILITIES === */

/* Bootstrap-compatible utility class */
.d-none {
  display: none !important;
}

.d-none-ds {
  display: none !important;
}

.d-block-ds {
  display: block !important;
}

.d-flex-ds {
  display: flex !important;
}

.d-inline-ds {
  display: inline !important;
}

.d-inline-block-ds {
  display: inline-block !important;
}

/* === FONT SIZE UTILITIES === */

.fs-large-icon {
  font-size: 5rem;
}

.fs-xl-icon {
  font-size: 3rem;
}

.w-90px {
  width: 90px;
}

/* ===================================================================
   END OF NEW 14-COLOR DESIGN SYSTEM COMPONENTS
   =================================================================== */

/* Image Uploader Component Styles */
.image-uploader {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-preview {
    width: 200px;
    height: 200px;
    border: 2px dashed var(--resi-border-color-medium, #ccc);
    border-radius: var(--resi-radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f8f9fa;
}

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

.preview-placeholder {
    color: var(--resi-text-tertiary, #999);
    font-size: var(--resi-font-size-sm, 14px);
}

.upload-controls {
    display: flex;
    gap: 0.5rem;
}

.hidden-file-input {
    display: none;
}

.upload-progress {
    width: 100%;
}

.upload-progress-hidden {
    display: none;
}

.progress-bar {
    width: 100%;
}

/* Global Header Styles - consistent across all pages */

/* Impersonation Banner Styles */
.user-switcher-width {
    width: 200px;
}
.narrow-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.narrow-left {
    display: flex;
    align-items: center;
}

.narrow-logo {
    height: 44px;
    width: auto;
    margin-right: 15px;
}

.narrow-title {
    color: #1565c0;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .narrow-header {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

[data-theme="dark"] .narrow-title {
    color: #60a5fa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Utility classes for colors */
.text-purple {
    color: #6f42c1 !important;
}

/* Gradient buttons */
.btn-gradient-purple {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
}

.btn-gradient-purple:hover {
    background: linear-gradient(45deg, #5a67d8, #6b3b8e);
    color: white;
}

/* Background utilities */
.bg-light-gray {
    background-color: #f8f9fa;
}

/* Icon utilities */
.icon-align-top {
    margin-top: 2px;
}

.icon-size-lg {
    font-size: 1.2rem;
}

/* Hidden elements */
.hidden {
    display: none;
}

/* Card improvements */
.card-light {
    background-color: #f8f9fa;
}

/* Spacing utilities for inline elements */
.mt-2px {
    margin-top: 2px;
}

/* Text utilities */
.text-break-all {
    word-break: break-all;
}

/* Width utilities */
.w-auto {
    width: auto;
}

.min-w-0 {
    min-width: 0;
}

/* Display utilities */
.d-inline {
    display: inline;
}

/* Typography */
.fs-09rem {
    font-size: 0.9rem;
}

.fs-085rem {
    font-size: 0.85rem;
}

/* List styles */
.list-style-none {
    list-style: none;
}

/* Flex utilities */
.flex-1 {
    flex: 1;
}

/* Specific component styles */
.supplier-details-card {
    background-color: #f8f9fa;
}

.error-badge {
    background: linear-gradient(45deg, #f56565, #e53e3e);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

/* Modal improvements */
.modal-security-icon {
    margin-top: 2px;
    font-size: 1.2rem;
}

/* API page specific styles */
.api-section {
    margin-bottom: 2rem;
}

.endpoint-card {
    border-left: 4px solid #007bff;
    margin-bottom: 1rem;
}

.method-badge {
    font-weight: bold;
    min-width: 60px;
    display: inline-block;
    text-align: center;
}

/* Order view styles */
.order-status-badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

/* Email admin styles */
.email-preview {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    padding: 1rem;
    background-color: #f8f9fa;
}

/* Supplier portal styles */
.portal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.settings-nav {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}

/* Empty state utilities */
.empty-state-icon {
    font-size: 3rem;
    color: #dee2e6;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Responsive utilities */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Loading state utilities */
.loading-container {
    text-align: center;
    padding: 50px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Print utilities */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Restaurant Interface (Resi) Component Classes
 * Using CSS variables from resi-theme-variables.css for cross-platform consistency
 * These classes work in both React Native Web PWA and HTML/CSS Admin Interface
 */

/* Resi Button Components */
.resi-button {
  background: var(--resi-primary);
  color: var(--resi-text-on-primary);
  border: none;
  border-radius: var(--resi-radius-md);
  padding: var(--resi-space-sm) var(--resi-space-lg);
  font-weight: var(--resi-font-weight-semibold);
  font-size: var(--resi-font-size-md);
  box-shadow: var(--resi-shadow-sm);
  cursor: pointer;
  transition: all var(--resi-duration-fast) var(--resi-ease-out);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* Touch-friendly minimum */
  line-height: var(--resi-line-height-normal);
}

.resi-button:hover {
  background: color-mix(in srgb, var(--resi-primary) 90%, black);
  transform: translateY(-1px);
  box-shadow: var(--resi-shadow-md);
}

.resi-button:active {
  transform: translateY(0);
  box-shadow: var(--resi-shadow-sm);
}

.resi-button:focus {
  outline: 2px solid var(--resi-primary);
  outline-offset: 2px;
}

/* Button Variants */
.resi-button-secondary {
  background: var(--resi-bg-surface);
  color: var(--resi-text-primary);
  border: var(--resi-border-width) solid var(--resi-border-color-medium);
}

.resi-button-secondary:hover {
  background: var(--resi-bg-secondary);
  border-color: var(--resi-border-color-strong);
}

.resi-button-ghost {
  background: transparent;
  color: var(--resi-primary);
  box-shadow: none;
}

.resi-button-ghost:hover {
  background: var(--resi-bg-secondary);
}

/* Button Sizes */
.resi-button-sm {
  padding: var(--resi-space-xs) var(--resi-space-md);
  font-size: var(--resi-font-size-sm);
  min-height: 36px;
}

.resi-button-lg {
  padding: var(--resi-space-md) var(--resi-space-xl);
  font-size: var(--resi-font-size-lg);
  min-height: 52px;
}

/* Resi Card Components */
.resi-card {
  background: var(--resi-bg-card);
  border-radius: var(--resi-radius-lg);
  padding: var(--resi-space-lg);
  box-shadow: var(--resi-shadow-sm);
  border: var(--resi-border-width) solid var(--resi-border-color);
  transition: box-shadow var(--resi-duration-fast) var(--resi-ease-out);
}

.resi-card:hover {
  box-shadow: var(--resi-shadow-md);
}

.resi-card-compact {
  padding: var(--resi-space-md);
}

.resi-card-spacious {
  padding: var(--resi-space-xl);
}

.resi-card-flat {
  box-shadow: none;
  border: var(--resi-border-width) solid var(--resi-border-color-medium);
}

/* Resi Hero Section */
.resi-hero {
  background: var(--resi-primary);
  color: var(--resi-text-on-primary);
  padding: var(--resi-space-lg);
  border-radius: var(--resi-radius-lg);
  position: relative;
  overflow: hidden;
}

.resi-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
  pointer-events: none;
}

.resi-hero-content {
  position: relative;
  z-index: 1;
}

.resi-hero h1,
.resi-hero h2,
.resi-hero h3 {
  color: var(--resi-text-on-primary);
  font-weight: var(--resi-font-weight-bold);
  margin-bottom: var(--resi-space-sm);
}

.resi-hero p {
  color: var(--resi-text-on-primary);
  opacity: 0.9;
  margin-bottom: var(--resi-space-md);
}

/* Resi Status Badge Components */
.resi-badge {
  padding: var(--resi-space-xs) var(--resi-space-sm);
  border-radius: var(--resi-radius-sm);
  font-size: var(--resi-font-size-sm);
  font-weight: var(--resi-font-weight-medium);
  line-height: var(--resi-line-height-tight);
  display: inline-flex;
  align-items: center;
  gap: var(--resi-space-xs);
  text-transform: capitalize;
}

.resi-badge-success {
  background: var(--resi-success);
  color: white;
}

.resi-badge-warning {
  background: var(--resi-warning);
  color: white;
}

.resi-badge-error {
  background: var(--resi-error);
  color: white;
}

.resi-badge-info {
  background: var(--resi-info);
  color: white;
}

.resi-badge-draft {
  background: var(--resi-draft);
  color: white;
}

/* Light badge variants for subtle backgrounds */
.resi-badge-success-light {
  background: var(--resi-success-light);
  color: var(--resi-success);
}

.resi-badge-warning-light {
  background: var(--resi-warning-light);
  color: var(--resi-warning);
}

.resi-badge-error-light {
  background: var(--resi-error-light);
  color: var(--resi-error);
}

.resi-badge-info-light {
  background: var(--resi-info-light);
  color: var(--resi-info);
}

.resi-badge-draft-light {
  background: var(--resi-draft-light);
  color: var(--resi-draft);
}

/* Resi Layout Components */
.resi-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--resi-space-md);
}

.resi-container-sm {
  max-width: 800px;
}

.resi-container-lg {
  max-width: 1400px;
}

.resi-section {
  margin-bottom: var(--resi-space-xl);
}

.resi-section:last-child {
  margin-bottom: 0;
}

/* Resi Grid System */
.resi-grid {
  display: grid;
  gap: var(--resi-space-lg);
}

.resi-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.resi-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.resi-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
  .resi-grid-2,
  .resi-grid-3,
  .resi-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Resi Typography Components */
.resi-heading-1 {
  font-size: var(--resi-font-size-xxxl);
  font-weight: var(--resi-font-weight-bold);
  line-height: var(--resi-line-height-tight);
  color: var(--resi-text-primary);
  margin-bottom: var(--resi-space-lg);
}

.resi-heading-2 {
  font-size: var(--resi-font-size-xxl);
  font-weight: var(--resi-font-weight-bold);
  line-height: var(--resi-line-height-tight);
  color: var(--resi-text-primary);
  margin-bottom: var(--resi-space-md);
}

.resi-heading-3 {
  font-size: var(--resi-font-size-xl);
  font-weight: var(--resi-font-weight-semibold);
  line-height: var(--resi-line-height-tight);
  color: var(--resi-text-primary);
  margin-bottom: var(--resi-space-sm);
}

.resi-text-body {
  font-size: var(--resi-font-size-md);
  font-weight: var(--resi-font-weight-normal);
  line-height: var(--resi-line-height-normal);
  color: var(--resi-text-primary);
  margin-bottom: var(--resi-space-md);
}

.resi-text-small {
  font-size: var(--resi-font-size-sm);
  font-weight: var(--resi-font-weight-normal);
  line-height: var(--resi-line-height-normal);
  color: var(--resi-text-secondary);
}

.resi-text-muted {
  color: var(--resi-text-muted);
}

/* Resi List Components */
.resi-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.resi-list-item {
  padding: var(--resi-space-md);
  border-bottom: var(--resi-border-width) solid var(--resi-border-color);
  display: flex;
  align-items: center;
  gap: var(--resi-space-md);
  transition: background-color var(--resi-duration-fast) var(--resi-ease-out);
}

.resi-list-item:last-child {
  border-bottom: none;
}

.resi-list-item:hover {
  background: var(--resi-bg-secondary);
}

.resi-list-item-clickable {
  cursor: pointer;
}

/* Resi Form Components */
.resi-input {
  width: 100%;
  padding: var(--resi-space-sm) var(--resi-space-md);
  border: var(--resi-border-width) solid var(--resi-border-color-medium);
  border-radius: var(--resi-radius-md);
  font-size: var(--resi-font-size-md);
  line-height: var(--resi-line-height-normal);
  background: var(--resi-bg-surface);
  color: var(--resi-text-primary);
  transition: border-color var(--resi-duration-fast) var(--resi-ease-out);
  min-height: 44px; /* Touch-friendly */
}

.resi-input:focus {
  outline: none;
  border-color: var(--resi-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--resi-primary) 20%, transparent);
}

.resi-textarea {
  min-height: 120px;
  resize: vertical;
}

.resi-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right var(--resi-space-sm) center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: var(--resi-space-xxl);
  cursor: pointer;
}

/* Resi Loading & Empty States */
.resi-loading {
  text-align: center;
  padding: var(--resi-space-xxl) var(--resi-space-md);
  color: var(--resi-text-secondary);
}

.resi-empty-state {
  text-align: center;
  padding: var(--resi-space-xxl) var(--resi-space-md);
  background: var(--resi-bg-secondary);
  border-radius: var(--resi-radius-lg);
}

.resi-empty-state-icon {
  font-size: var(--resi-font-size-xxxl);
  color: var(--resi-text-tertiary);
  margin-bottom: var(--resi-space-md);
}

.resi-empty-state h3 {
  color: var(--resi-text-secondary);
  font-size: var(--resi-font-size-lg);
  font-weight: var(--resi-font-weight-semibold);
  margin-bottom: var(--resi-space-sm);
}

.resi-empty-state p {
  color: var(--resi-text-muted);
  font-size: var(--resi-font-size-sm);
  margin-bottom: var(--resi-space-lg);
}

/* Resi Utilities */
.resi-text-center { text-align: center; }
.resi-text-left { text-align: left; }
.resi-text-right { text-align: right; }

.resi-flex { display: flex; }
.resi-flex-col { flex-direction: column; }
.resi-flex-wrap { flex-wrap: wrap; }
.resi-items-center { align-items: center; }
.resi-items-start { align-items: flex-start; }
.resi-items-end { align-items: flex-end; }
.resi-justify-center { justify-content: center; }
.resi-justify-between { justify-content: space-between; }
.resi-justify-start { justify-content: flex-start; }
.resi-justify-end { justify-content: flex-end; }

.resi-gap-xs { gap: var(--resi-space-xs); }
.resi-gap-sm { gap: var(--resi-space-sm); }
.resi-gap-md { gap: var(--resi-space-md); }
.resi-gap-lg { gap: var(--resi-space-lg); }
.resi-gap-xl { gap: var(--resi-space-xl); }

.resi-m-0 { margin: 0; }
.resi-mb-md { margin-bottom: var(--resi-space-md); }
.resi-mb-lg { margin-bottom: var(--resi-space-lg); }
.resi-mt-md { margin-top: var(--resi-space-md); }
.resi-mt-lg { margin-top: var(--resi-space-lg); }

.resi-p-0 { padding: 0; }
.resi-p-sm { padding: var(--resi-space-sm); }
.resi-p-md { padding: var(--resi-space-md); }
.resi-p-lg { padding: var(--resi-space-lg); }

.resi-w-full { width: 100%; }
.resi-h-full { height: 100%; }

.resi-rounded { border-radius: var(--resi-radius-md); }
.resi-rounded-lg { border-radius: var(--resi-radius-lg); }
.resi-rounded-full { border-radius: var(--resi-radius-full); }

.resi-shadow { box-shadow: var(--resi-shadow-sm); }
.resi-shadow-md { box-shadow: var(--resi-shadow-md); }
.resi-shadow-lg { box-shadow: var(--resi-shadow-lg); }

/* Responsive utilities */
@media (max-width: 768px) {
  .resi-hide-mobile { display: none !important; }
  .resi-container { padding: 0 var(--resi-space-sm); }
  .resi-hero { padding: var(--resi-space-md); }
  .resi-card { padding: var(--resi-space-md); }
}

/* ===== Toast Notification Styles ===== */
/* Centralized toast styles for consistent UX across all admin pages */
/* Based on OrderToast.jsx pattern with auto-dismiss only */

/* Toast Container - Fixed top-right positioning */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

/* Base Toast - Card-like appearance */
.toast {
  display: flex !important; /* Override Bootstrap's display:none */
  align-items: center;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  background-color: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease-out;
  max-width: 280px;
  opacity: 1 !important; /* Override Bootstrap's opacity */
}

/* Toast fade-out state */
.toast.hiding {
  animation: toastFadeOut 0.3s ease-in forwards;
}

/* Light Mode - Solid backgrounds with semantic left borders */
.toast-success {
  border-left: 3px solid var(--success);
}

.toast-success i {
  color: var(--success);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-warning i {
  color: var(--warning);
}

.toast-danger {
  border-left: 3px solid var(--danger);
}

.toast-danger i {
  color: var(--danger);
}

.toast-info {
  border-left: 3px solid var(--info);
}

.toast-info i {
  color: var(--info);
}

/* Dark Mode - uses same left border pattern */
body.dark-mode .toast {
  background-color: var(--bg);
  border: 1px solid var(--border);
}

/* Animations */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Mobile responsive */
@media (max-width: 576px) {
  .toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    max-width: none;
  }
}

/* ===== Modal Component Styles ===== */
/* Centralized modal styles for consistent dialogs across all pages */

.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--bg);
  margin: auto;
  border-radius: 8px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

.modal-content-lg {
  max-width: 800px;
}

.modal-content-sm {
  max-width: 400px;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: 8px 8px 0 0;
}

.modal-header h4,
.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  color: var(--text-muted);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
  background: var(--bg-secondary);
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  color: var(--text);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg);
  border-radius: 0 0 8px 8px;
}

.modal-description {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

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

/* Dark mode modal adjustments */
body.dark-mode .modal {
  background-color: rgba(0, 0, 0, 0.7);
}

body.dark-mode .modal-content {
  background-color: var(--dark-bg-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

/* ===== Table Component Styles ===== */
/* Centralized table styles for consistent data tables across all pages */

.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table thead {
  background-color: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

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

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

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

.table tbody td {
  padding: 0.75rem 1rem;
  color: var(--text);
  vertical-align: middle;
}

.table-striped tbody tr:nth-child(even) {
  background-color: var(--bg-secondary);
}

.table-bordered {
  border: 1px solid var(--border);
}

.table-bordered th,
.table-bordered td {
  border: 1px solid var(--border);
}

.table-sm thead th,
.table-sm tbody td {
  padding: 5px;
}

/* Table cell utilities */
.table-cell-center {
  text-align: center;
}

.table-cell-right {
  text-align: right;
}

.table-cell-nowrap {
  white-space: nowrap;
}

.table-cell-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Enhanced Form Component Styles ===== */
/* Add validation states and additional form components */

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:disabled,
.form-control.readonly {
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Form validation states */
.form-control.is-valid {
  border-color: var(--success);
}

.form-control.is-valid:focus {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.1);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.1);
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-error,
.invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--danger);
}

.form-success,
.valid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--success);
}

/* Form layouts */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.form-inline .form-control {
  flex: 1;
}

/* Checkbox and radio styles */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-check-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.form-check-label {
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
}

/* Select dropdown styles */
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em;
  padding-right: 2.5rem;
  appearance: none;
}

/* Textarea styles */
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* ===== Loading Spinner Styles ===== */
/* Centralized loading indicators */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.loading-spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 4px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

body.dark-mode .loading-overlay {
  background: rgba(0, 0, 0, 0.8);
}

/* ===== Alert/Info Box Styles ===== */
/* Centralized alert components */

.alert {
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success-dark);
}

.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning-dark);
}

.alert-danger,
.alert-error {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger-dark);
}

.alert-info {
  background: var(--info-light);
  border-color: var(--info);
  color: var(--info-dark);
}

.alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.alert-message {
  font-size: 0.9rem;
}

/* ===== Supplier Portal Utilities ===== */
/* Reusable utility components for supplier pages */

/* Supplier-style toast (bottom-right positioning) */

/* Loading indicator (text-based) */
.loading-indicator {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary, #666);
}

.loading-indicator i {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

/* Spinning animation utility */
.spinning {
  animation: spin 1s linear infinite;
}

/* Empty state component */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary, #666);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  color: var(--text-primary, #333);
}

.empty-state p {
  margin-bottom: 1.5rem;
}

/* Search and filter containers */
.search-container {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.search-container i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #666);
}

.search-container input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #333);
}

.search-container input:focus {
  outline: none;
  border-color: var(--primary-color, #4F46E5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.filter-container {
  display: flex;
  gap: 0.75rem;
}

.filter-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #333);
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color, #4F46E5);
}

/* Dark mode adjustments for supplier utilities */
body.dark-mode .empty-state h3,
[data-theme="dark"] .empty-state h3 {
  color: var(--text, #f3f4f6);
}

body.dark-mode .search-container input,
body.dark-mode .filter-select,
[data-theme="dark"] .search-container input,
[data-theme="dark"] .filter-select {
  background: var(--bg, #1f2937);
  color: var(--text, #f3f4f6);
  border-color: var(--border, #374151);
}

/* ===================================================================
   TOGGLE GROUP COMPONENT (Universal)
   Button-based toggle for 2+ options (Active/Inactive, Pack/Weight, etc.)
   Based on filter-bar design - clean, simple, inline-flex
   =================================================================== */
.toggle-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--bg);
}

.toggle-group-btn {
  padding: 6px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  background-color: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-group-btn:first-child {
  border-right: 1px solid var(--border);
}

.toggle-group-btn.active {
  background-color: rgba(249, 115, 22, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.toggle-group-btn:hover:not(.active) {
  background-color: var(--bg-light);
}

/* Dark mode support */
body.dark-mode .toggle-group {
  background-color: var(--bg);
  border-color: var(--border);
}

body.dark-mode .toggle-group-btn {
  background-color: var(--bg);
}

body.dark-mode .toggle-group-btn.active {
  background-color: rgba(249, 115, 22, 0.15);
  color: var(--primary);
}

body.dark-mode .toggle-group-btn:hover:not(.active) {
  background-color: var(--bg-light);
}

/* Full-width variant for modals */
.toggle-group-full {
  display: flex;
  width: 100%;
}

.toggle-group-full .toggle-group-btn {
  flex: 1;
}