/**
 * SHARED STYLES FOR SPARE PARTS ERP
 * Common styles used across all HTML files
 * Prevents duplication and ensures consistent theming
 */

/* ============================================================================
   FONTS & GLOBAL RESETS
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

* {
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

/* ============================================================================
   GRADIENTS
   ============================================================================ */
.gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-primary,
.theme-gradient {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.gradient-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gradient-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.gradient-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

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

/* ============================================================================
   CARD COMPONENTS
   ============================================================================ */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 20px;
}

.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pending {
  background: #FEF3C7;
  color: #92400E;
}

.status-confirmed {
  background: #DBEAFE;
  color: #1E40AF;
}

.status-processing {
  background: #E0E7FF;
  color: #4338CA;
}

.status-shipped,
.status-completed {
  background: #D1FAE5;
  color: #065F46;
}

.status-cancelled {
  background: #FEE2E2;
  color: #991B1B;
}

/* Badge variants */
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-yellow {
  background: #fef3c7;
  color: #b45309;
}

.badge-red {
  background: #fee2e2;
  color: #dc2626;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-outline {
  background: #fff;
  color: #475569;
  border: 2px solid #e2e8f0;
}

.btn-outline:hover {
  border-color: #6366f1;
  color: #6366f1;
}

/* ============================================================================
   INPUTS & FORMS
   ============================================================================ */
.input-focus {
  transition: all 0.2s;
}

.input-focus:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
  transform: scale(1.01);
}

/* ============================================================================
   MODALS & OVERLAYS
   ============================================================================ */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* ============================================================================
   SPINNER / LOADING
   ============================================================================ */
.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  width: 1.5rem;
  height: 1.5rem;
  animation: spin 0.6s linear infinite;
}

/* ============================================================================
   TABLES
   ============================================================================ */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0;
}

/* Force high-contrast headers for catalog parts tables */
.parts-table thead tr {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
}

.parts-table thead th {
  background: transparent !important;
  color: #f8fafc !important;
  border-bottom: 1px solid #475569 !important;
}

td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  font-size: 0.88rem;
}

tr:hover {
  background: #f8fafc;
}

.dr {
  color: #dc2626;
  font-weight: 600;
}

.cr {
  color: #059669;
  font-weight: 600;
}

/* ============================================================================
   NAVIGATION LINKS
   ============================================================================ */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.85rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.15s;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================================================
   TABS
   ============================================================================ */
.tab {
  padding: 10px 20px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}

.tab:hover {
  color: #6366f1;
}

.tab.active {
  color: #6366f1;
  border-color: #6366f1;
}

/* ============================================================================
   ACCORDION
   ============================================================================ */
.accordion-content {
  display: none;
}

.accordion-content.open {
  display: block;
}

/* ============================================================================
   RADIO BUTTONS
   ============================================================================ */
.radio-label {
  cursor: pointer;
  user-select: none;
}

.radio-label:hover {
  background: rgba(99, 102, 241, 0.05);
}

input[type="radio"]:checked + label {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
}

/* ============================================================================
   DARK MODE STYLES
   ============================================================================ */
.dark-mode {
  background-color: #0a0a0a !important;
  color: #f3f4f6 !important;
}

/* Background overrides */
.dark-mode .bg-white,
.dark-mode .pos-left,
.dark-mode .card {
  background-color: #1a1a1a !important;
  color: #f3f4f6 !important;
}

.dark-mode .bg-gray-50,
.dark-mode .pos-right,
.dark-mode .cart-head {
  background-color: #262626 !important;
}

.dark-mode .bg-gray-100 {
  background-color: #2d2d2d !important;
}

.dark-mode .bg-gray-200 {
  background-color: #3a3a3a !important;
}

/* Text color overrides */
.dark-mode .text-gray-900,
.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode .dd-price,
.dark-mode .cr-tot,
.dark-mode .cr-qty {
  color: #f3f4f6 !important;
}

.dark-mode .text-gray-800 {
  color: #e5e7eb !important;
}

.dark-mode .text-gray-700,
.dark-mode .cr-desc {
  color: #d1d5db !important;
}

.dark-mode .text-gray-600 {
  color: #9ca3af !important;
}

.dark-mode .text-gray-500 {
  color: #6b7280 !important;
}

/* Border overrides */
.dark-mode .border-gray-200 {
  border-color: #404040 !important;
}

.dark-mode .border-gray-300 {
  border-color: #525252 !important;
}

/* Input overrides */
.dark-mode input,
.dark-mode select,
.dark-mode textarea,
.dark-mode .search-inner input {
  background-color: #262626 !important;
  color: #f3f4f6 !important;
  border-color: #404040 !important;
}

/* Component-specific dark mode */
.dark-mode .dd,
.dark-mode .np-btn,
.dark-mode .ctrl-tab {
  background-color: #1a1a1a !important;
  color: #f3f4f6 !important;
  border-color: #404040 !important;
}

.dark-mode .dd-item:hover,
.dark-mode .cart-row:hover {
  background-color: #262626 !important;
}

.dark-mode .cart-row.sel {
  background-color: rgba(99, 102, 241, 0.2) !important;
}

.dark-mode .radio-label {
  background-color: #1a1a1a !important;
  color: #f3f4f6 !important;
}

/* Shadow adjustments for dark mode */
.dark-mode .shadow-lg,
.dark-mode .shadow-xl,
.dark-mode .shadow-2xl {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3) !important;
}

/* Table adjustments */
.dark-mode .parts-table tbody tr:hover {
  background: linear-gradient(90deg, #1a1a1a 0%, #262626 100%) !important;
}

.dark-mode .parts-table thead tr {
  background: linear-gradient(135deg, #334155 0%, #1f2937 100%) !important;
}

.dark-mode .parts-table thead th {
  background: transparent !important;
  color: #f8fafc !important;
  border-bottom: 1px solid #4b5563 !important;
}

.dark-mode th {
  background: #1a1a1a !important;
  color: #9ca3af !important;
}

.dark-mode td {
  color: #d1d5db !important;
  border-color: #404040 !important;
}

.dark-mode tr:hover {
  background: #262626 !important;
}
