/* index.css - Premium Design System */

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

:root {
  --brand-blue: #125ba7;
  --brand-blue-hover: #0d4681;
  --brand-blue-light: #e6f0fa;
  --bg-light: #f8f9fa;
  --text-dark: #1f2937;
  --text-grey: #6b7280;
  --border-grey: #e5e7eb;
  --card-bg: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-light);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 0.25rem;
  letter-spacing: -0.025em;
}

.subtitle {
  color: var(--text-grey);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-weight: 400;
}

/* Forms and Inputs */
input[type="text"],
input[type="password"],
input[type="date"],
select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  background-color: #fff;
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

input:focus, select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--brand-blue-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--brand-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background-color: var(--brand-blue-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--brand-blue);
  background-image: linear-gradient(180deg, var(--brand-blue) 0%, #0c3d70 100%);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 15px rgba(0,0,0,0.1);
  z-index: 10;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
}

.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  padding: 1.5rem 0;
}

.sidebar-logo {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: serif;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  white-space: nowrap;
  transition: opacity 0.3s, max-width 0.3s;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-logo {
  opacity: 0;
  max-width: 0;
  margin: 0;
}

.sidebar-toggle {
  background: transparent;
  color: white;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1rem;
}

.sidebar.collapsed .sidebar-nav {
  padding: 0 0.5rem;
}

.nav-item {
  padding: 1rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item i {
  min-width: 24px;
  font-size: 1.1rem;
  display: flex;
  justify-content: center;
  margin-right: 1rem;
  transition: margin 0.3s;
}

.sidebar.collapsed .nav-item i {
  margin-right: 0;
}

.nav-item-text {
  transition: opacity 0.3s;
}

.sidebar.collapsed .nav-item-text {
  opacity: 0;
  visibility: hidden;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: white;
  transform: translateX(4px);
}

.sidebar.collapsed .nav-item:hover {
  transform: scale(1.05); /* slightly different hover when collapsed */
}

.nav-item.active {
  background-color: white;
  color: var(--brand-blue);
  box-shadow: var(--shadow-md);
  font-weight: 600;
}

.nav-item {
  padding: 1rem 1.5rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: white;
  transform: translateX(4px);
}

.nav-item.active {
  background-color: white;
  color: var(--brand-blue);
  box-shadow: var(--shadow-md);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  /* padding: 2.5rem 3.5rem; */
  padding: 0 2rem 0.5rem 2rem;
  background-color: var(--bg-light);
  overflow-y: auto;
}

/* Cards */
.stats-container {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  flex: 1;
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid var(--border-grey);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-blue-light);
}

.stat-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-grey);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brand-blue);
  line-height: 1;
}

.stat-unit {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-grey);
  margin-left: 0.25rem;
}

/* Filters */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-grey);
}

.filter-bar .flex-spacer {
  flex: 1;
}

/* Tables */
.table-wrapper {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden; /* For border radius */
  border: 1px solid var(--border-grey);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-grey);
}

th {
  background-color: #f9fafb;
  font-weight: 600;
  color: var(--text-grey);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background-color: var(--brand-blue-light);
}

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

td {
  color: var(--text-dark);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Action Icons */
.action-icon {
  color: var(--text-grey);
  cursor: pointer;
  font-size: 1.1rem;
  margin: 0 0.5rem;
  transition: var(--transition);
  padding: 0.5rem;
  border-radius: 50%;
}

.action-icon:hover {
  color: var(--brand-blue);
  background-color: #f3f4f6;
  transform: scale(1.1);
}

/* Utility */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }

/* Footer */
.app-footer {
    margin-top: auto; /* push to bottom if content is short */
    padding-top: 2.5rem;
    padding-bottom: 1rem;
    text-align: center;
    color: var(--text-grey);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 0.4s forwards;
}

/* Entrance Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.main-content > h1,
.main-content > .subtitle,
.main-content > .stats-container,
.main-content > .filter-bar,
.main-content > .table-wrapper,
.main-content > .report-section,
.main-content > .header-bar {
  opacity: 0;
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.main-content > *:nth-child(1) { animation-delay: 0.05s; }
.main-content > *:nth-child(2) { animation-delay: 0.1s; }
.main-content > *:nth-child(3) { animation-delay: 0.15s; }
.main-content > *:nth-child(4) { animation-delay: 0.2s; }
.main-content > *:nth-child(5) { animation-delay: 0.25s; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: white;
  width: 90%;
  max-width: 650px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: all 0.3s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-grey);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f9fafb;
}

.modal-header h3 {
  color: var(--brand-blue);
  font-size: 1.25rem;
  margin: 0;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-grey);
  cursor: pointer;
  transition: color 0.2s;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #ef4444;
  background-color: #fce8e8;
}

.modal-body {
  padding: 2rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.modal-field {
  display: flex;
  flex-direction: column;
}

.modal-field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-grey);
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: 0.05em;
}

.modal-field span {
  font-weight: 500;
  color: var(--text-dark);
  font-size: 1rem;
}

.kyc-doc-preview {
  width: 100%;
  height: 180px;
  background-color: var(--bg-light);
  border: 2px dashed var(--border-grey);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-grey);
  gap: 0.5rem;
}

.kyc-doc-preview i {
  font-size: 2.5rem;
  color: var(--brand-blue);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
}

.nav-item.sign-out {
  color: #fca5a5;
  margin-top: auto;
}

.nav-item.sign-out:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* File Upload Zone */
.file-upload-zone {
  border: 2px dashed var(--border-grey);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  background-color: var(--bg-light);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.file-upload-zone:hover {
  border-color: var(--brand-blue);
  background-color: var(--brand-blue-light);
}

.file-upload-zone i {
  font-size: 2.5rem;
  color: var(--brand-blue);
  margin-bottom: 1rem;
}

.file-upload-zone p {
  color: var(--text-grey);
  font-size: 0.9rem;
  font-weight: 500;
}

.file-upload-zone input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Searchable Dropdown Custom Styles */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-input {
  width: 100%;
  padding-right: 2.5rem;
}

.custom-dropdown-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-grey);
  pointer-events: none;
}

.custom-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
  margin-top: 0.5rem;
}

.custom-dropdown-list.show {
  display: block;
}

.custom-dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--bg-light);
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-dropdown-item:hover {
  background-color: var(--brand-blue-light);
  color: var(--brand-blue);
}

.custom-dropdown-item .vehicle-type {
  font-size: 0.8rem;
  color: var(--text-grey);
  margin-left: auto;
}

/* Advanced Numeric Inputs */
.input-with-icon-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon-suffix i.input-prefix-icon {
  position: absolute;
  left: 1rem;
  color: var(--brand-blue);
  font-size: 1.15rem;
  pointer-events: none;
}

.input-with-icon-suffix input {
  width: 100%;
  padding-left: 3rem;
  padding-right: 4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.input-with-icon-suffix .input-suffix {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  background-color: var(--bg-light);
  color: var(--text-grey);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border-left: 1px solid var(--border-grey);
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: var(--transition);
}

.input-with-icon-suffix input:focus ~ .input-suffix {
  border-left-color: var(--brand-blue);
  color: var(--brand-blue);
  background-color: var(--brand-blue-light);
}

.single-card-layout {
  max-width: 650px;
  margin: 2rem 0;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .trip-grid, .stats-container, .modal-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 1rem;
    align-items: center;
    background-image: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: none;
  }

  .sidebar.collapsed {
    width: 100%;
  }

  .sidebar-header {
    margin: 0;
    padding: 0;
    width: 100%;
  }
  
  .sidebar-logo {
    font-size: 1.5rem;
  }

  .sidebar-nav, .sidebar-footer {
    display: none;
    width: 100%;
  }

  .sidebar.mobile-open .sidebar-nav,
  .sidebar.mobile-open .sidebar-footer {
    display: flex;
    flex-direction: column;
  }
  
  .main-content {
    padding: 1.5rem 1rem;
  }
  
  .header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .user-filters {
    flex-direction: column;
  }
  
  .search-wrapper {
    max-width: 100%;
  }
}

/* Top Navigation Bar */
.top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 0.5rem 2rem;
    background-color: white;
    border-bottom: 1px solid var(--border-grey);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 5;
    margin-left: -3.5rem;
    margin-right: -3.5rem;
    margin-top: 0;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-grey);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.8rem !important;
    background-color: #f3f4f6 !important;
    border: 1px solid transparent !important;
    font-size: 0.9rem !important;
}

.search-box input:focus {
    background-color: white !important;
    border-color: var(--brand-blue) !important;
    box-shadow: 0 0 0 3px var(--brand-blue-light) !important;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-signout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-grey);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.topbar-signout:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

.topbar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: 1.5rem;
    border-right: 1px solid var(--border-grey);
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--brand-blue-light);
    color: var(--brand-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.topbar-user-details {
    display: flex;
    flex-direction: column;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
}

.topbar-user-role {
    font-size: 0.75rem;
    color: var(--text-grey);
}
