/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

body {
  background: linear-gradient(135deg, #0d0d0d, #1c2526); /* Softer gradient for depth */
  color: #e0e0e0; /* Light gray for better contrast */
  overflow-x: hidden;
}

/* ===== Scrollbars ===== */
::-webkit-scrollbar {
  width: 8px; /* Thinner scrollbar for elegance */
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03); /* Subtle track */
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(108, 158, 251, 0.4); /* Slightly more transparent */
  border-radius: 10px;
  border: 2px solid rgba(30, 30, 30, 0.9);
  transition: all 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 158, 251, 0.7); /* Brighter on hover */
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 158, 251, 0.4) rgba(30, 30, 30, 0.9);
}

/* ===== Container ===== */
.container {
  display: flex;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 300px;
  background: rgba(30, 30, 30, 0.85); /* More transparent for glass effect */
  backdrop-filter: blur(14px); /* Enhanced blur */
  color: #e0e0e0;
  padding: 80px 20px 20px 20px;
  position: fixed;
  top: 0;
  left: -300px;
  height: 100%;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sidebar.show {
  left: 0;
}
.sidebar ul {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}
.sidebar li {
  margin: 10px 0;
  border-radius: 10px;
  transition: background 0.3s ease, transform 0.2s ease;
}
.sidebar li:hover,
.sidebar li.active {
  background: rgba(255, 255, 255, 0.1); /* Subtle hover effect */
  transform: scale(1.02);
}
.sidebar a {
  display: block;
  padding: 12px 18px;
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.25s ease;
}
.sidebar a:hover {
  color: #7ab0ff; /* Softer blue for hover */
}
.sidebar hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 12px 0;
}

/* ===== Main ===== */
.main {
  flex: 1;
  margin-left: 0;
  transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.main.shift {
  margin-left: 300px;
}

/* ===== PDF Title ===== */
#title-pdf-name {
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(30, 30, 30, 0.85); /* More transparent */
  backdrop-filter: blur(14px);
  color: #e0e0e0;
  font-weight: 600;
  font-size: 1.3rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  padding: 0 20px;
}

/* ===== PDF Content ===== */
#pdf-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  width: 100%;
  align-items: start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px;
  padding: 64px 10px;
  background: #181818; /* Slightly darker background */
}

/* ===== Page Container ===== */
.page-card-container {
  width: max-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: rgba(30, 30, 30, 0.85); /* Glassmorphism effect */
  backdrop-filter: blur(14px);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-decoration: none;
  transition: 
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
    background 0.4s ease;
}
.page-card-container:hover {
  box-shadow: 0 16px 40px rgba(108, 158, 251, 0.3);
  transform: translateY(-6px) scale(1.05) rotate3d(1, 1, 0, 2deg);
  background: rgba(40, 40, 40, 0.9);
}

.page-card-img {
  width: 250px;
  height: 400px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  background-color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: 
    box-shadow 0.4s ease, 
    border-color 0.4s ease,
    filter 0.4s ease;
}
.page-card-container:hover .page-card-img {
  box-shadow: 0 12px 36px rgba(108, 158, 251, 0.4);
  border-color: #7ab0ff;
  filter: brightness(1.1) contrast(1.05);
}

.page-card-title {
  text-align: center;
  margin-top: 5px;
  color: #e0e0e0;
  font-size: 20px;
  transition: color 0.3s ease, transform 0.3s ease;
}
.page-card-container:hover .page-card-title {
  color: #7ab0ff;
  transform: translateY(3px);
}

.page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 95%;
  max-width: 1000px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  background: #222222; /* Slightly lighter for contrast */
}

.page-top {
  background: #222222;
  width: 100%;
  display: flex;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
  padding: 12px 16px;
}

/* Page title */
.page-title {
  color: #e0e0e0;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  max-width: 200px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(50, 50, 50, 0.4);
}

/* Page buttons */
.page-buttons {
  display: flex;
  gap: 10px;
}
.page-button {
  background: rgba(50, 50, 50, 0.85);
  backdrop-filter: blur(10px);
  color: #e0e0e0;
  border: none;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.page-button:hover {
  background: rgba(108, 158, 251, 0.25);
  transform: scale(1.08);
}
.page-button:active {
  transform: scale(0.95);
}

/* Canvas */
#pdf-content canvas {
  max-width: 100%;
  height: max-content;
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ===== Burger ===== */
.burger {
  position: fixed;
  top: 8px;
  left: 20px;
  z-index: 1100;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(40, 40, 40, 0.85);
  backdrop-filter: blur(14px);
  border-radius: 12px;
  transition: all 0.2s ease;
}
.burger i {
  font-size: 24px;
  color: #e0e0e0;
}
.burger.active i {
  color: #7ab0ff;
}
.burger:hover {
  background: rgba(108, 158, 251, 0.2);
}

/* ===== PDF Tools ===== */
.pdf_tools {
  position: fixed;
  top: 8px;
  right: 20px;
  z-index: 1100;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(40, 40, 40, 0.85);
  backdrop-filter: blur(14px);
  border-radius: 12px;
  transition: all 0.2s ease;
}
.pdf_tools:hover {
  background: rgba(108, 158, 251, 0.2);
}
.pdf_tools i {
  font-size: 24px;
  color: #e0e0e0;
}

/* PDF tools menu */
.pdf_tools_menu {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 70px;
  right: 20px;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  width: 220px;
  z-index: 1200;
}
.pdf_tools_menu.show {
  display: flex;
}
.pdf_option_wrapper label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: #e0e0e0;
  cursor: pointer;
  padding: 10px 0;
}
.pdf_option_wrapper input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #7ab0ff;
  cursor: pointer;
}

/* ===== PDF Router ===== */
.page-pdf-router {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 24px 0;
  background: rgba(30, 30, 30, 0.85);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
}
.pdf-route-btn {
  background: rgba(50, 50, 50, 0.85);
  border: none;
  color: #e0e0e0;
  font-size: 1.2rem;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pdf-route-btn:hover {
  background: rgba(108, 158, 251, 0.25);
  transform: scale(1.08);
}
.pdf-route-btn:active {
  transform: scale(0.95);
}

.pdf-route-value {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdf-route-input {
  width: 70px;
  padding: 8px 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #e0e0e0;
  text-align: center;
}
.pdf-route-input::-webkit-outer-spin-button,
.pdf-route-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pdf-route-input[type="number"] {
  -moz-appearance: textfield;
}
.pdf-route-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Loading Box (Refined with #7ab0ff) ===== */
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px; /* masofa sal uzoqroq qilindi */
  padding: 55px 80px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.65),
              inset 0 0 30px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(150%);
  animation: pop 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-style: preserve-3d;
}

.loading-box i {
  font-size: 7rem;
  line-height: 1;
  color: #7ab0ff; /* asosiy rang */
  animation: spin 1.3s linear infinite, glow 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(122, 176, 255, 0.6));
  will-change: transform, filter;
}

.loading-text {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, #7ab0ff, #4facfe, #7ab0ff);
  background-size: 250%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 1.6s ease-in-out infinite, gradientFlow 4s linear infinite;
}

#loading-progress {
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.25),
              0 2px 6px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(122, 176, 255, 0.8)) drop-shadow(0 0 40px rgba(122, 176, 255, 0.6)); }
  50% { filter: drop-shadow(0 0 40px rgba(122, 176, 255, 1)) drop-shadow(0 0 80px rgba(122, 176, 255, 0.9)); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes pop {
  0% { transform: scale(0.8) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .loading-box,
  .loading-box i,
  .loading-text {
    animation: none !important;
  }
}

/* fa-spinner */
.fa-spinner {
  font-size: 7rem;
  color: #7ab0ff;
  animation: spin 1.3s linear infinite, glow 2.5s ease-in-out infinite;
  display: inline-block;
  margin-bottom: 30px;
}







/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 240px;
    padding: 60px 16px 16px 16px;
  }
  .main.shift {
    margin-left: 240px;
  }
  .page-container {
    width: 95%;
  }
  .pdf-route-input {
    width: 50px;
    padding: 6px 8px;
    font-size: 0.9rem;
  }
  .page-button {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  .pdf-route-btn {
    padding: 8px 12px;
    font-size: 1rem;
  }
}
@media (max-width: 480px) {
  .sidebar {
    width: 200px;
    padding: 50px 12px 12px 12px;
  }
  .main.shift {
    margin-left: 200px;
  }
  .pdf-route-input {
    width: 45px;
    padding: 4px 6px;
    font-size: 0.8rem;
  }
  .page-button {
    padding: 4px 10px;
    font-size: 0.75rem;
  }
}