/* Premium UI Design System for M/S SHARIFUL TRADERS */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Hind+Siliguri:wght@400;500;600;700&family=Roboto+Mono:wght@400;500;600;700&display=swap');

:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --surface: #ffffff;
  --bg-page: #f8fafc;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --sidebar-bg: #090e1a;
  --sidebar-border: #1e293b;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', 'Hind Siliguri', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Login Screen Styling */
#loginScreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: flex !important;
}
#loginScreen.hidden {
  display: none !important;
}
#appRoot.hidden {
  display: none !important;
}

#appRoot {
  display: flex !important;
  flex-direction: row !important;
  height: 100vh !important;
  width: 100vw !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Sidebar Responsive Positioning */
@media (max-width: 1023px) {
  #appSidebar {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100% !important;
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border) !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7) !important;
  }
  #appSidebar.mobile-open {
    transform: translateX(0) !important;
  }
  #sidebarBackdrop {
    position: fixed !important;
    inset: 0 !important;
    background-color: rgba(2, 6, 23, 0.65) !important;
    backdrop-filter: blur(3px) !important;
    z-index: 9998 !important;
    display: block;
  }
  #sidebarBackdrop.hidden {
    display: none !important;
  }
  #appMainWrapper {
    width: 100vw !important;
    min-width: 100vw !important;
    flex: 1 1 100% !important;
  }
}

@media (min-width: 1024px) {
  #appSidebar {
    position: relative !important;
    transform: none !important;
    width: 260px !important;
    flex-shrink: 0 !important;
    height: 100% !important;
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border) !important;
    z-index: 20 !important;
  }
  #appMainWrapper {
    flex: 1 1 0% !important;
    min-width: 0 !important;
  }
}

#appMainWrapper {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background-color: var(--bg-page);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Card & Surface Styling */
.card-shadow {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
}

.card-shadow-hover {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-shadow-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* Premium Sidebar Links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 9px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}
.sidebar-link:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-link.active {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  font-weight: 700;
}

/* Vehicle Plate Tag */
.vehicle-plate-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fef08a;
  color: #713f12;
  border: 1px solid #eab308;
  padding: 2.5px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.3px;
  font-family: 'Roboto Mono', monospace;
}

/* Tables */
.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.modern-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 5;
}
.modern-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.modern-table tbody tr {
  transition: background-color 0.1s ease;
}
.modern-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Monospace Numbers */
.num-val {
  font-family: 'Roboto Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* Inputs & Form Elements */
input, select, textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12) !important;
}

/* Modal Animations */
.modal-overlay {
  transition: opacity 0.2s ease;
  backdrop-filter: blur(4px);
  background-color: rgba(15, 23, 42, 0.55);
}
.modal-content-box {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
}

/* Order Processing Card: Crisp Rounded RGB Border */
@keyframes rgbRotate {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.rgb-glow-card {
  position: relative;
  background: #ffffff;
  border-radius: 1rem;
  z-index: 1;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rgb-glow-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(1rem + 2px);
  background: linear-gradient(
    90deg,
    #ff007f,
    #8b5cf6,
    #3b82f6,
    #06b6d4,
    #10b981,
    #f59e0b,
    #ff007f
  );
  background-size: 300% 300%;
  animation: rgbRotate 5s linear infinite;
  z-index: -1;
}

.rgb-glow-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
}

/* Global Floating Table Action Dropdown */
#globalActionDropdown {
  position: fixed;
  z-index: 999999;
  min-width: 195px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 35px -5px rgba(15, 23, 42, 0.2), 0 10px 15px -5px rgba(15, 23, 42, 0.1);
  padding: 6px;
  animation: fadeInDropdown 0.12s ease-out;
}
.action-btn-trigger {
  cursor: pointer;
  user-select: none;
}

/* Fallback Table Action Dropdown Menu */
.action-dropdown-group {
  position: relative;
  display: inline-block;
}
.action-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 175px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  padding: 6px;
  z-index: 60;
  animation: fadeInDropdown 0.15s ease-out;
}
.action-dropdown-group:hover .action-dropdown-menu,
.action-dropdown-group:focus-within .action-dropdown-menu {
  display: block;
}
@keyframes fadeInDropdown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile & Touch Responsive Enhancements */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch !important;
}

@media (max-width: 768px) {
  .modern-table {
    min-width: 720px;
  }
  .modern-table th, .modern-table td {
    padding: 8px 10px;
    font-size: 11.5px;
  }
  .modal-content-box {
    margin: 10px !important;
    max-height: 94vh !important;
    border-radius: 1.25rem !important;
  }
  #modernModalBody {
    padding: 1rem !important;
  }
  button, input, select, a {
    touch-action: manipulation;
  }
}

/* Print Invoice Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .no-print, header, aside, .tabs-bar, .action-buttons {
    display: none !important;
  }
  main {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .printable-area {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}
