/* ETSM Global Styles */
:root {
  --black: #000000;
  --gray: #6b7280;
  --white: #ffffff;
  --orange: #C63F00;
  --orange-hover: #B03800;
  --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;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-100: #dcfce7;
  --green-800: #166534;
  --blue-100: #dbeafe;
  --blue-800: #1e40af;
  --purple-100: #f3e8ff;
  --purple-800: #6b21a8;
  --yellow-400: #facc15;
}

/* Base Styles */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Disable tap highlight on mobile devices */
a, button, input, select, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@300;400;500;600;700;800&display=swap');

body {
  font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--black);
  background-color: var(--white);
  margin: 0;
  padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 1rem 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 1rem 0;
}

a {
  color: var(--orange);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--orange-hover);
}

/* Layout Components */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--gray-50);
}

.app-sidebar {
  width: 16rem;
  background-color: var(--white);
  border-right: 1px solid var(--gray-200);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.app-main {
  flex: 1;
  margin-left: 16rem;
  padding-top: 4rem;
}

.app-content {
  padding: 2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }
  
  .app-main {
    margin-left: 0;
  }
  
  .app-content {
    padding: 1rem;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(198, 63, 0, 0.5);
}

.btn-primary {
  background-color: var(--orange);
  color: var(--white);
  border-color: var(--orange);
}

.btn-primary:hover {
  background-color: var(--orange);
  border-color: var(--orange);
  color: var(--white) !important;
  opacity: 0.9;
}

.btn-secondary {
  background-color: var(--orange);
  color: var(--white);
  border-color: var(--orange);
}

.btn-secondary:hover {
  background-color: var(--orange);
  border-color: var(--orange);
  color: var(--white) !important;
  opacity: 0.9;
}

.btn-danger {
  background-color: var(--red-500);
  color: var(--white);
  border-color: var(--red-500);
}

.btn-danger:hover {
  background-color: var(--red-600);
  border-color: var(--red-600);
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Cards */
.card {
  background-color: var(--white);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--black);
  margin: 0;
}

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

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

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(198, 63, 0, 0.1);
}

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

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

/* Navigation */
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background-color: var(--gray-50);
  color: var(--black);
}

.nav-link.active {
  background-color: var(--orange);
  color: var(--white);
}

.nav-link svg {
  margin-right: 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
}

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

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-black { color: var(--black); }
.text-white { color: var(--white); }

.bg-white { background-color: var(--white); }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }

.border { border: 1px solid var(--gray-200); }
.border-t { border-top: 1px solid var(--gray-200); }
.border-b { border-bottom: 1px solid var(--gray-200); }
.border-r { border-right: 1px solid var(--gray-200); }

.rounded { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }

.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.m-4 { margin: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.mobile-sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 16rem;
  height: 100vh;
  background-color: var(--white);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  z-index: 50;
  overflow-y: auto;
}

.mobile-sidebar.open {
  transform: translateX(0);
}

/* Focus trap for accessibility */
.focus-trap {
  position: relative;
}

/* Ensure all orange buttons maintain white text on hover */
button[class*="bg-orange"]:hover,
a[class*="bg-orange"]:hover,
.btn[class*="bg-orange"]:hover {
  color: var(--white) !important;
}

/* Specific override for Tailwind classes */
.bg-orange:hover {
  color: var(--white) !important;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  border-top-color: var(--orange);
  animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 640px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .app-content {
    padding: 1rem 0.5rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }
}

/* Hide Scrollbar for Horizontal Scroll */
.scrollbar-hide {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.scrollbar-hide::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Ensure scrollable containers work properly on mobile */
@media (max-width: 768px) {
  /* Make scrollbars visible on mobile for vertical scrolling */
  .overflow-y-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
  }
  
  .overflow-y-auto::-webkit-scrollbar {
    width: 6px;
  }
  
  .overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .overflow-y-auto::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
  }
  
  .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .app-sidebar,
  .mobile-sidebar {
    display: none !important;
  }
  
  .app-main {
    margin-left: 0 !important;
  }
}
