/* Modern CSS Framework for Starlab Inventory */

:root {
  /* Color Palette */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Grays */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Border radius */
  --rounded-sm: 0.125rem;
  --rounded: 0.25rem;
  --rounded-md: 0.375rem;
  --rounded-lg: 0.5rem;
  --rounded-xl: 0.75rem;
  --rounded-full: 9999px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--gray-700);
  background-color: var(--gray-50);
  min-height: 100vh;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout Components */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: var(--space-6);
  padding-bottom: var(--space-12); /* Ensure space before footer */
  max-width: 1200px;
  margin: 0 auto;
  width: 85%;
}

/* Desktop padding for narrower content - moved to end for higher specificity */

/* Header & Navigation */
.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: var(--space-8);
  align-items: center;
}

.nav-link {
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--rounded-md);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--gray-100);
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary);
  color: white;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

.card-body {
  padding: var(--space-6);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--rounded-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  gap: var(--space-2);
}

.btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
  color: white;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-lg);
}

/* Input Group Styles */
.input-group {
  display: flex;
  align-items: center;
  position: relative;
}

.input-prefix {
  position: absolute;
  left: 1rem;
  z-index: 2;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

.input-group .form-input {
  padding-left: 2.5rem;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--rounded-md);
  font-size: var(--text-sm);
  transition: all 0.2s ease;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:invalid {
  border-color: var(--danger);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  background-image: url("data:image/svg+xml,%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 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
  appearance: none;
}

.form-help {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: var(--space-1);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Alerts */
.alert {
  padding: var(--space-4);
  border-radius: var(--rounded-md);
  border: 1px solid;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fed7aa;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Tables */
.table-container {
  background: white;
  border-radius: var(--rounded-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-900);
  font-size: var(--text-sm);
}

.table tr:hover {
  background: var(--gray-50);
}

.table tr.low-stock {
  background: #fdf2f8;
}

/* Simplified Table Styles */
.item-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  line-height: 1.3;
}

.part-number {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  margin-bottom: var(--space-1);
}

.item-type {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
}

.location-cell {
  color: var(--text-secondary);
  font-weight: 500;
}

.stock-cell .stock-display {
  margin-bottom: var(--space-1);
}

.stock-ok {
  color: var(--success);
  font-weight: 600;
  font-size: 1.1rem;
}

.stock-low {
  color: var(--warning);
  font-weight: 600;
  font-size: 1.1rem;
}

.stock-low small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.8;
}

.stock-out {
  color: var(--danger);
  font-weight: 600;
  font-size: 1.1rem;
}

.stock-out small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.8;
}

.trigger-level {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.actions-cell .action-buttons {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  align-items: center;
}

/* Item Thumbnails */
.item-thumbnail {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--border-light);
  background: var(--background-muted);
}

.item-thumbnail-placeholder {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 2px solid var(--border-light);
  background: var(--background-muted);
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: white;
  padding: var(--space-6);
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-content {
    padding: var(--space-4);
    width: 100%;
  }
  
  .navbar {
    padding: 0 var(--space-4);
    flex-direction: column;
    height: auto;
    gap: var(--space-4);
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }
  
  .navbar-nav {
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
  
  .table-container {
    overflow-x: auto;
  }
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Content wrapper for 85% width */
.content-wrapper {
  width: 85%;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: var(--space-4);
}

/* Priority badges */
.priority-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--rounded);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}

.priority-critical {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.priority-high {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fed7aa;
}

.priority-normal {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.priority-low {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.priority-badge.out-of-stock {
  background: #fca5a5 !important;
  color: #7f1d1d !important;
  border-color: #f87171 !important;
}

.priority-badge.urgent-stock {
  border: 2px solid var(--warning) !important;
}

