/* Global Styles with Tailwind */

/* CSS Variables - Professional Handmade Design */
:root {
  /* Primary Colors - Warm Earthy Professional */
  --primary: #6B5B73;
  --primary-dark: #4A3D52;
  --primary-light: #8B7A95;
  
  /* Accent - Warm Terracotta */
  --accent: #C97D60;
  --accent-light: #D89A85;
  
  /* Neutrals - Warm Beige & Browns */
  --dark: #3E3A35;
  --text: #4A4540;
  --text-light: #8B8680;
  --border: #E8E4DF;
  --bg: #FAF8F3;
  --white: #FFFFFF;
  
  /* Status */
  --success: #48BB78;
  --warning: #ED8936;
  --error: #F56565;
  --info: #4299E1;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

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

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Loading Spinner */
.spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 300px;
  background: white;
  padding: 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease-out;
  z-index: 9999;
}

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

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

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

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

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

/* Utility Classes */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* Responsive Tables */
.table-container {
  overflow-x: auto !important;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  min-height: 600px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.table-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

.data-table thead {
  background: linear-gradient(to right, #6B5B73, #4A3D52);
  color: white;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.data-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(to right, #6B5B73, #4A3D52);
  position: sticky;
  top: 0;
  z-index: 21;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

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

/* Card Component */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(74, 85, 104, 0.4);
  transform: translateY(-1px);
}

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

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-secondary {
  background: #e5e7eb;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #d1d5db;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-error {
  color: var(--error);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Smart Compact Pagination */
.pagination-wrapper {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #f5f5f5;
  border-radius: 12px;
}

.pagination-info-simple {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.pagination-info-simple strong {
  color: #374151;
  font-weight: 600;
}

.pagination-controls-simple {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-btn-simple {
  min-width: 44px;
  height: 44px;
  padding: 0 0.75rem;
  border: none;
  background: #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn-simple:hover:not(.active) {
  background: #d1d5db;
}

.pagination-btn-simple.active {
  background: #3B82F6;
  color: white;
  font-weight: 600;
}

.pagination-btn-simple.pagination-nav {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 1.125rem;
  font-weight: 600;
}

.pagination-btn-simple.pagination-nav:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.pagination-ellipsis {
  padding: 0 0.5rem;
  color: #9ca3af;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  height: 44px;
}

.pagination-goto {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.pagination-goto span {
  font-size: 0.875rem;
  color: #6b7280;
}

.goto-input {
  width: 70px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: center;
  background: white;
}

.goto-input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.goto-btn {
  height: 36px;
  padding: 0 1rem;
  border: none;
  background: #3B82F6;
  color: white;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.goto-btn:hover {
  background: #2563EB;
}
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination span {
  padding: 0.5rem;
  color: var(--text-light);
}

/* ============================================
   COMPREHENSIVE RESPONSIVE STYLES
   Mobile-First Approach with Breakpoints
   ============================================ */

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
  /* Typography */
  body {
    font-size: 14px;
  }
  
  h1, .navbar-breadcrumb {
    font-size: 1.25rem !important;
  }
  
  h2 {
    font-size: 1.125rem !important;
  }
  
  /* Cards */
  .card {
    padding: 1rem !important;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
  }
  
  /* Buttons */
  .btn {
    padding: 0.625rem 1rem !important;
    font-size: 0.813rem !important;
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Forms */
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-label {
    font-size: 0.813rem;
    margin-bottom: 0.375rem;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
  }
  
  /* Tables */
  .table-container {
    max-height: calc(100vh - 200px);
    margin: 0 -1rem;
    border-radius: 0;
  }
  
  .data-table {
    min-width: 800px;
    font-size: 0.75rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.375rem !important;
    font-size: 0.75rem !important;
  }
  
  /* Stats Grid */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1.25rem !important;
  }
  
  .stat-card-value {
    font-size: 1.5rem !important;
  }
  
  .stat-card-title {
    font-size: 0.813rem;
  }
  
  /* Modals */
  .modal-content {
    max-width: 95% !important;
    max-height: 95vh !important;
    padding: 1rem !important;
    margin: 0.5rem;
  }
  
  /* Toast */
  .toast {
    min-width: calc(100% - 2rem);
    right: 1rem;
    left: 1rem;
    top: 1rem;
  }
  
  /* Pagination */
  .pagination {
    gap: 0.25rem;
    flex-wrap: wrap;
  }
  
  .pagination button {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
  
  /* Badges */
  .badge {
    font-size: 0.688rem;
    padding: 0.188rem 0.5rem;
  }
}

/* Tablet (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  /* Cards */
  .card {
    padding: 1.25rem;
  }
  
  /* Tables */
  .data-table {
    min-width: 1000px;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.625rem 0.5rem;
    font-size: 0.813rem;
  }
  
  /* Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  
  /* Buttons */
  .btn {
    padding: 0.688rem 1.25rem;
    font-size: 0.875rem;
  }
  
  /* Modals */
  .modal-content {
    max-width: 90%;
    padding: 1.5rem;
  }
}

/* Small Desktop (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Tables */
  .data-table {
    min-width: 1100px;
  }
}

/* Responsive - Legacy Support */
@media (max-width: 768px) {
  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.813rem;
  }
  
  /* Grid layouts stack on mobile */
  .grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Flex layouts stack on mobile */
  .flex-row {
    flex-direction: column !important;
  }
  
  /* Filter sections stack */
  .filter-section,
  .filters {
    flex-direction: column !important;
  }
  
  /* Forms stack */
  .form-grid,
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
}

@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  .card {
    box-shadow: none;
    page-break-inside: avoid;
  }
}

