@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");

:root {
  --primary-color: #0077ff;
  --secondary-color: #2d2d2d;
  --bg-color: #f9fafb;
  --sidebar-bg: #ffffff;
  --text-color: #333333;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --border-color: #f0f0f0;
  --search-bg: #f3f4f6;
  --muted-text: #888888;
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --hover-bg: #fff5f2;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --sidebar-bg: #1e293b;
  --text-color: #f1f5f9;
  --header-bg: #1e293b;
  --card-bg: #1e293b;
  --border-color: #334155;
  --search-bg: #334155;
  --muted-text: #94a3b8;
  --hover-bg: #334155;
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: "DM Sans", "Inter", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
a {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), #ff8e6e);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-card {
  background: var(--card-bg);
  padding: 3rem;
  border-radius: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 400px;
  text-align: center;
}

#app-container {
  display: flex;
  width: 100%;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.2rem;
  position: fixed;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.2rem;
  text-decoration: none;
  color: var(--muted-text);
  border-radius: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-link i {
  margin-right: 12px;
  font-style: normal;
}

.feather {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: middle;
}

.nav-link .feather {
  margin-right: 12px;
}

.nav-link:hover {
  color: var(--primary-color);
  background: var(--hover-bg);
}

.nav-link.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 8px 15px rgba(255, 95, 46, 0.3);
}

.main-wrapper {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-header {
  background: var(--header-bg);
  padding: 1rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
  border-bottom: 1px solid var(--border-color);
}

.search-bar {
  background: var(--search-bg);
  padding: 0.7rem 1.5rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  width: 450px;
}

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  margin-left: 10px;
  width: 100%;
  color: var(--text-color);
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

#theme-toggle,
#sidebar-toggle {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 10px;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#sidebar-toggle {
  display: none;
}

#theme-toggle:hover,
#sidebar-toggle:hover {
  background: var(--hover-bg);
  color: var(--primary-color);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.user-badge img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.content-area {
  padding: 2rem 3rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  flex: 1;
}

.hero-banner {
  background:
    linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url("https://images.unsplash.com/photo-1481627834876-b7833e8f5570?ixlib=rb-1.2.1&auto=format&fit=crop&w=1200&q=80");
  background-size: cover;
  background-position: center;
  height: 220px;
  border-radius: 24px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: white;
  margin-bottom: 2rem;
}

.hero-banner h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.hero-btns {
  display: flex;
  gap: 15px;
}

.hero-btns button {
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-primary {
  user-select: none;
  border: none;
  outline: none;
  background: var(--primary-color);
  color: white;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(5px);
}

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

.section-header h2 {
  font-size: 1.3rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.book-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.book-card:hover {
  transform: translateY(-5px);
}

.book-card .cover {
  width: 100%;
  height: 220px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 1rem;
}

.book-card h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}
.book-card .author {
  font-size: 0.85rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.8rem;
}
.book-card .author img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.book-card .footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.book-card .price {
  font-weight: 700;
  color: var(--primary-color);
}

.buy-btn {
  padding: 0.5rem 1rem;
  background: #fff5f2;
  color: var(--primary-color);
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.buy-btn:hover {
  background: var(--primary-color);
  color: white;
}

.widget {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--card-shadow);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.widget-header h3 {
  font-size: 1rem;
}
.see-more {
  font-size: 0.8rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.author-list,
.free-books {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.author-item,
.free-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-item img,
.free-item img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}
.item-info h4 {
  font-size: 0.9rem;
}
.item-info p {
  font-size: 0.75rem;
  color: #888;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 30px;
  width: 90%;
  max-width: 450px;
  position: relative;
}

.close-btn:hover {
  color: #666;
}

.close-btn-v2 {
  width: 32px;
  height: 32px;
  background: var(--search-bg);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted-text);
  transition: var(--transition);
}

.close-btn-v2:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.modal-header-v2 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.modal-body-horizontal {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.modal-left {
  flex: 0 0 280px;
}

.modal-right {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.modal-right .detail-field:first-child {
  grid-column: span 2;
}

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

tbody tr:hover {
  background-color: var(--hover-bg) !important;
  cursor: pointer;
}

.detail-header {
  text-align: center;
  margin-bottom: 2rem;
}

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-color);
}

.detail-header p {
  color: #888;
  font-size: 0.9rem;
  margin-top: 4px;
}

.detail-img-container {
  width: 100%;
  margin-bottom: 2rem;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-img-container img {
  width: 100%;
  height: auto;
  display: block;
}

.detail-field {
  margin-bottom: 1.2rem;
  text-align: left;
}

.detail-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted-text);
  margin-bottom: 6px;
}

.detail-field-box {
  background: var(--search-bg);
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  color: var(--text-color);
  font-weight: 600;
  font-size: 0.95rem;
}

.modal-form {
  margin-top: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted-text);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--search-bg);
  font-family: "Inter", sans-serif;
  color: var(--text-color);
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px rgba(0, 119, 255, 0.1);
}

.modal-footer {
  display: flex;
  gap: 12px;
  margin-top: 2rem;
}

.modal-footer button {
  flex: 1;
  padding: 0.8rem;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-cancel {
  background: var(--search-bg);
  color: var(--muted-text);
}

.btn-cancel:hover {
  background: #e2e8f0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.8rem;
  border-radius: 24px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.stat-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.stat-info .stat-value {
  font-size: 2.2rem;
  font-weight: 800;
}

.stat-icon-bg {
  background: rgba(255, 255, 255, 0.2);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bg-orange {
  background: linear-gradient(135deg, #ff9d2e, #ff5f2e);
}
.bg-pink {
  background: linear-gradient(135deg, #ff4b82, #e61e50);
}
.bg-purple {
  background: linear-gradient(135deg, #9d3eff, #6a11cb);
}
.bg-card {
  background: #ccdeff;
}

.tracking-card {
  padding: 10px 0;
}

.road-container {
  height: 40px;
  background: var(--search-bg);
  border-radius: 12px;
  position: relative;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px dashed var(--border-color);
}

.anim-car {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  animation: drive 8s linear infinite;
}

@keyframes drive {
  0% {
    left: -40px;
  }
  100% {
    left: 100%;
  }
}

.timeline-mini {
  border-left: 2px solid var(--border-color);
  padding-left: 15px;
  margin-left: 5px;
}

.timeline-item-mini {
  margin-bottom: 15px;
  position: relative;
}

.timeline-item-mini::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 5px;
  width: 10px;
  height: 10px;
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
}

.timeline-item-mini h5 {
  font-size: 0.8rem;
  color: var(--primary-color);
  margin-bottom: 2px;
}

.timeline-item-mini p {
  font-size: 0.75rem;
  color: var(--muted-text);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
  }

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

  .main-wrapper {
    margin-left: 0;
  }

  .top-header {
    padding: 1rem 1.5rem;
  }

  .search-bar {
    display: none;
  }

  #sidebar-toggle {
    display: flex;
  }

  .content-area {
    padding: 1.5rem;
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-banner {
    padding: 1.5rem;
    height: auto;
    min-height: 200px;
  }

  .hero-banner h1 {
    font-size: 1.5rem;
  }

  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }

  .modal-body-horizontal {
    flex-direction: column;
    gap: 1.5rem;
  }

  .modal-left {
    flex: none;
    width: 100%;
  }

  .modal-right {
    grid-template-columns: 1fr;
  }

  .modal-right .detail-field:first-child {
    grid-column: span 1;
  }

  .tracking-info-grid {
    grid-template-columns: 1fr;
  }

  .info-item {
    grid-column: span 1 !important;
  }

  footer {
    padding: 1.5rem;
  }
}

/* Collapsed Sidebar */
.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 2rem 0.6rem;
}

.sidebar-collapsed .sidebar .logo span {
  display: none;
}

.sidebar-collapsed .sidebar .logo {
  justify-content: center;
  gap: 0;
}

.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.9rem 0;
}

.sidebar-collapsed .nav-link span {
  display: none;
}

.sidebar-collapsed .nav-link .feather,
.sidebar-collapsed .nav-link i {
  margin-right: 0;
}

.sidebar-collapsed .main-wrapper {
  margin-left: 72px;
}

.sidebar-collapse-btn {
  background: var(--search-bg);
  border: none;
  padding: 8px;
  border-radius: 10px;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: var(--hover-bg);
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .sidebar-collapse-btn {
    display: none;
  }
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

.tracking-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--search-bg);
  border-radius: 16px;
}

.info-item p:first-child {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item p:last-child {
  font-weight: 700;
  color: var(--text-color);
}

.timeline-v2 {
  margin-top: 2rem;
  position: relative;
}

.timeline-v2::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border-color);
}

.timeline-v2-item {
  position: relative;
  padding-left: 35px;
  margin-bottom: 2.5rem;
}

.timeline-v2-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 16px;
  height: 16px;
  background: var(--card-bg);
  border: 3px solid var(--border-color);
  border-radius: 50%;
  z-index: 1;
  transition: all 0.3s ease;
}

.timeline-v2-item.active .timeline-v2-dot {
  border-color: #10b981;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.timeline-v2-time {
  font-size: 0.8rem;
  color: var(--muted-text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-v2-content {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 8px;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
}
.badge-warning {
  background: #fef9c3;
  color: #a16207;
}
.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}
.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

footer {
  margin-top: auto;
  padding: 2rem 3rem;
  display: flex;
  align-items: center;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--muted-text);
  gap: 5px;
  text-align: center;
}

table {
  background: var(--bg-color);
}
