/*
 * Modern, Minimalist Design System for Procurement App
 * Clean, professional, and user-friendly interface
 */

/* CSS Custom Properties (Variables) */
:root {
  /* Colors */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-400: #38bdf8;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --primary-800: #075985;
  --primary-900: #0c4a6e;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;
  
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  
  /* Typography */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  
  /* 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;
  --space-20: 5rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Removed shadows for cleaner, minimalist design */
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

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

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-sans);
  line-height: 1.6;
  color: var(--gray-800);
  background-color: #f9fafc;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Authentication Layout Styles */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fafafa;
  padding: var(--space-4);
}

.auth-container {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.auth-header {
  text-align: center;
  padding: var(--space-12) var(--space-8) var(--space-2);
  background: white;
  color: var(--gray-800);
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
}

.logo-placeholder {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  border: 2px dashed var(--gray-300);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.navbar-logo-placeholder {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-400);
  border: 2px dashed var(--gray-300);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
}

/* Breadcrumb styling */
.breadcrumb {
  font-size: 0.875rem;
  margin-bottom: var(--space-1);
}

.breadcrumb-item a {
  color: var(--gray-600);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: var(--gray-800);
  text-decoration: underline;
}

/* Card styling with white background */
.card {
  background: white;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Table styling for purchase request items */
.purchase-items-table {
  border-bottom: none !important;
}

.auth-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.025em;
}

.auth-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  margin: 0;
  font-weight: 400;
}

.auth-body {
  padding: var(--space-8);
}

/* Form Styles */
.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  background: white;
}

.form-input:focus {
  outline: none;
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input.is-invalid {
  border-color: var(--error-500);
}

.invalid-feedback {
  display: block;
  font-size: 0.875rem;
  color: var(--error-600);
  margin-top: var(--space-1);
}

/* Link Styles */
.auth-links {
  text-align: center;
  padding: var(--space-6) var(--space-8) var(--space-8);
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.auth-link {
  color: var(--primary-600);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.auth-link:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

/* Alert Styles */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
}

.alert-success {
  background: var(--success-50);
  color: var(--success-600);
  border-color: var(--success-500);
}

.alert-danger {
  background: var(--error-50);
  color: var(--error-600);
  border-color: var(--error-500);
}

.alert-warning {
  background: var(--warning-50);
  color: var(--warning-600);
  border-color: var(--warning-500);
}

/* Loading States */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 640px) {
  .auth-layout {
    padding: var(--space-8);
  }
  
  .auth-container {
    max-width: none;
    margin: 0;
  }
  
  .auth-header {
    padding: var(--space-10) var(--space-10) var(--space-8);
  }
  
  .auth-body {
    padding: var(--space-10);
  }
  
  .auth-links {
    padding: var(--space-6) var(--space-10) var(--space-8);
  }
  
  /* Increase form spacing on mobile */
  .form-group {
    margin-bottom: var(--space-8);
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.875rem;
}

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

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mt-4 {
  margin-top: var(--space-4);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Centered flash messages for auth pages */
.auth-flash {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  max-width: 500px;
  width: 90%;
  text-align: center;
  border-radius: var(--radius-md);
  font-weight: 500;
}

/* ========================================
   SLEEK TABLE SYSTEM
   Modern, minimalist table styling
   ======================================== */

/* Table Container */
.sleek-table-container {
  background: white;
  border-radius: 12px;
  border: none;
  overflow: visible;
}

.sleek-table-responsive {
  overflow: visible;
  border-radius: 12px;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Remove table shadow when inside a card to avoid double shadows */
.card .sleek-table-responsive {
  box-shadow: none;
}

/* Base Table */
.sleek-table {
  border: none;
  margin-bottom: 0;
}

/* Table Header */
.sleek-table thead {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.sleek-table thead th {
  border: none;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #374151;
  vertical-align: middle;
}

.sleek-table thead th:first-child {
  border-top-left-radius: 12px;
}

.sleek-table thead th:last-child {
  border-top-right-radius: 12px;
}

/* Table Body */
.sleek-table tbody tr {
  border-bottom: 1px solid #f1f3f4;
  transition: none;
}

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

.sleek-table tbody td {
  border: none;
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

/* Last row bottom corners */
.sleek-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}

.sleek-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

/* Remove hover effects */
.sleek-table tbody tr:hover {
  background-color: transparent;
}

/* Dropdown positioning for tables */
.sleek-table .dropdown {
  position: static;
}

.sleek-table .dropdown-menu {
  border-radius: 8px;
  padding: 0.5rem 0;
  min-width: 140px;
  z-index: 1050;
  position: absolute;
  border: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sleek-table .dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.sleek-table .dropdown-item i {
  font-size: 0.875rem;
  color: #6c757d;
  margin-right: 0.5rem;
}

.sleek-table .dropdown-divider {
  margin: 0.5rem 0;
}

/* Action button styling */
.sleek-table .btn-action {
  background: none;
  border: none;
  padding: 0.5rem;
  color: #6c757d;
  box-shadow: none;
  transition: all 0.2s ease;
}

.sleek-table .btn-action:hover {
  background-color: #f1f3f4;
  color: #495057;
}

/* Badge styling for tables */
.sleek-badge {
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 50px;
}

.sleek-badge-primary {
  background: #e3f2fd;
  color: #1976d2;
}

.sleek-badge-secondary {
  background: #f5f5f5;
  color: #9e9e9e;
}

/* Text styling for tables */
.sleek-table-text-primary {
  font-weight: 500;
  color: #1a1a1a;
  font-size: 0.95rem;
}

.sleek-table-text-secondary {
  color: #6c757d;
  font-size: 0.875rem;
  line-height: 1.4;
}

.sleek-table-text-muted {
  color: #9e9e9e;
  font-size: 0.8rem;
  font-weight: 400;
}

.sleek-table-text-italic {
  color: #adb5bd;
  font-style: italic;
}

/* Link styling in tables */
.sleek-table a {
  text-decoration: none;
  color: inherit;
}

.sleek-table a:hover {
  color: inherit;
  text-decoration: none;
}

/* ========================================
   ACTIVITY TIMELINE SYSTEM
   Clean timeline for activity tracking
   ======================================== */

.timeline {
  position: relative;
  padding-left: 0;
  margin: 0;
}

.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-left: 3rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 1.125rem;
  top: 2rem;
  bottom: -2rem;
  width: 2px;
  background: #e5e7eb;
}

.timeline-item-last::before {
  display: none;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 0.25rem;
  width: 2.25rem;
  height: 2.25rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-marker i {
  font-size: 0.875rem;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-content h6 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.timeline-content .text-muted {
  color: #6b7280;
}

.timeline-content .alert-light {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* Timeline responsive adjustments */
@media (max-width: 768px) {
  .timeline-item {
    padding-left: 2.5rem;
  }
  
  .timeline-marker {
    width: 2rem;
    height: 2rem;
  }
  
  .timeline-item::before {
    left: 0.875rem;
  }
}

/* ========================================
   COMMENTS SYSTEM
   Modern comment styling with avatars
   ======================================== */

.comments-container {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.comments-container::-webkit-scrollbar {
  width: 4px;
}

.comments-container::-webkit-scrollbar-track {
  background: #f1f3f4;
  border-radius: 2px;
}

.comments-container::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

.comments-container::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.comment-item {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid #e9ecef;
}

.comment-item:last-child {
  margin-bottom: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.comment-meta {
  flex: 1;
  min-width: 0;
}

.comment-author {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.2;
}

.comment-time {
  color: #6b7280;
  font-size: 0.75rem;
  margin: 0;
  line-height: 1.2;
}

.comment-content {
  color: #374151;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
  word-wrap: break-word;
}

.comment-content p {
  margin: 0 0 0.5rem 0;
}

.comment-content p:last-child {
  margin-bottom: 0;
}

.add-comment-form {
  background: white;
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.add-comment-form:focus-within {
  border-color: #3b82f6;
  border-style: solid;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.comment-textarea {
  border: none;
  background: transparent;
  resize: vertical;
  min-height: 80px;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.comment-textarea:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

.comment-textarea::placeholder {
  color: #9ca3af;
  font-style: italic;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f3f4f6;
}

.btn-add-comment {
  background: #3b82f6;
  border: none;
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-add-comment:hover {
  background: #2563eb;
  color: white;
}

.btn-add-comment:active {
  transform: translateY(0);
}

.comments-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #9ca3af;
}

.comments-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  font-size: 1.25rem;
}

.comments-empty-text {
  font-size: 0.875rem;
  font-style: italic;
  margin: 0;
}

.comment-avatar {
  background: var(--primary-600);
}

/* ========================================
   SELECT2 BOOTSTRAP STYLING
   Make Select2 look like Bootstrap form-select
   ======================================== */

/* Main container */
.select2-container {
  width: 100% !important;
}

/* Single select styling to match Bootstrap form-select */
.select2-container--default .select2-selection--single {
  height: 38px;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background-color: #fff;
  padding: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  position: relative;
}

/* Remove Select2's default arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  display: none;
}

/* Text styling */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #212529;
  line-height: 36px;
  padding-left: 0.75rem;
  padding-right: 2.25rem;
  font-size: 1rem;
}

/* Placeholder styling */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #6c757d;
}

/* Focus state to match Bootstrap */
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Dropdown styling */
.select2-dropdown {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  z-index: 1056; /* Above Bootstrap modals */
}

/* Search input in dropdown */
.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  margin: 0.5rem;
  width: calc(100% - 1rem);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Dropdown options */
.select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  color: #212529;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #0d6efd;
  color: #fff;
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #e9ecef;
  color: #212529;
}

/* Round bottom corners for last option when hovered */
.select2-container--default .select2-results__option:last-child.select2-results__option--highlighted {
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
}

/* Clear button styling */
.select2-container--default .select2-selection__clear {
  color: #6c757d;
  cursor: pointer;
  position: absolute;
  right: 0.94rem;
  top: 10px;
  font-weight: bold;
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.select2-container--default .select2-selection__clear:hover {
  color: #495057;
}

/* Disabled state */
.select2-container--default.select2-container--disabled .select2-selection--single {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

/* Invalid state for form validation */
.select2-container.is-invalid .select2-selection--single {
  border-color: #dc3545;
}

.select2-container.is-invalid.select2-container--focus .select2-selection--single {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Small Select2 styling - reusable class */
.select2-sm + .select2-container .select2-selection--single {
  height: 31px !important;
  font-size: 0.875rem !important;
  padding: 0 !important;
  background-position: right 0.5rem center !important;
  background-size: 12px 9px !important;
}

.select2-sm + .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 29px !important;
  padding-left: 0.5rem !important;
  padding-right: 1.75rem !important;
  font-size: 0.875rem !important;
}

.select2-sm + .select2-container .select2-selection__clear {
  right: 0.94rem !important;
  top: 8px !important;
  font-size: 0.875rem !important;
  width: 12px !important;
  height: 12px !important;
}

/* Smaller font size for New Vendor button */
.btn-new-vendor {
  font-size: 0.875rem !important;
}