
:root {
  --primary-red: #e5322d;
  --primary-red-hover: #c7241f;
  --bg-light: #f4f5f8;
  --bg-white: #ffffff;
  --text-dark: #161616;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --radius-lg: 12px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.btn-hamburger {
  display: none;
  background: transparent;
  border: none;
  font-size: 22px;
  color: #1f2937;
  cursor: pointer;
  padding: 8px;
}

.brand-logo {
  display: flex;
  align-items: center;
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: -0.5px;
  user-select: none;
}

.brand-i { color: #161616; }
.brand-heart { color: var(--primary-red); margin: 0 4px; font-size: 22px; }
.brand-pdf { color: #161616; }

.nav-links {
  display: flex;
  gap: 4px;
  height: 100%;
}

.nav-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  padding: 0 16px;
  height: 100%;
  cursor: pointer;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.nav-btn:hover { color: var(--primary-red); }
.nav-btn.active, .nav-btn-highlight.open {
  color: var(--primary-red);
  border-bottom-color: var(--primary-red);
}

.nav-arrow { font-size: 10px; transition: transform 0.2s; }

.dropdown-wrap { position: relative; height: 100%; }

/* Дропдаун конвертации */
.convert-dropdown-menu {
  display: none;
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  gap: 36px;
  z-index: 600;
  width: 560px;
}

.convert-dropdown-menu.show { display: flex; }

.dropdown-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dropdown-heading {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.dropdown-item:hover {
  background-color: #fef2f2;
  color: var(--primary-red);
}

.dropdown-item.active {
  color: var(--primary-red);
  font-weight: 700;
}

.item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.text-yellow { color: #f59e0b; }
.text-blue { color: #3b82f6; }
.text-orange { color: #ea580c; }
.text-green { color: #10b981; }
.text-red { color: var(--primary-red); }
.text-purple { color: #8b5cf6; }

/* 7-колоночное Мега-меню */
.mega-menu {
  display: none;
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 32px 40px;
  z-index: 600;
}

.mega-menu.show { display: block; }

.mega-menu-grid {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 20px;
}

.mega-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mega-heading {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.nav-auth { display: flex; align-items: center; gap: 12px; }

.btn-text {
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-register {
  background: var(--primary-red);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.btn-register:hover { background: var(--primary-red-hover); }

.btn-icon-menu {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #4b5563;
  cursor: pointer;
  padding: 6px;
}

/* МОБИЛЬНЫЙ DRAWER */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
}

.mobile-drawer-overlay.show { display: block; }

.mobile-drawer {
  position: fixed;
  top: 0; left: -320px; bottom: 0;
  width: 300px;
  background: var(--bg-white);
  z-index: 999;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-drawer.open { left: 0; }

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  font-size: 22px;
  color: #4b5563;
  cursor: pointer;
}

.drawer-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.drawer-accordion-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  padding: 8px 0;
  text-decoration: none;
  cursor: pointer;
}

.drawer-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 18px 0;
}

.drawer-auth-buttons {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-drawer-login {
  background: #fff;
  color: var(--primary-red);
  border: 2px solid var(--primary-red);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-drawer-register {
  background: var(--primary-red);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* HERO SECTION */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.hero-section {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  transition: background-color 0.2s;
}

.hero-section.dragover {
  background-color: #ffeaea;
  border: 3px dashed var(--primary-red);
}

.hero-content { max-width: 680px; }

.hero-content h1 {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text-dark);
}

.hero-content p {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 36px;
  line-height: 1.5;
}

.upload-btn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-main-action {
  background: var(--primary-red);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  padding: 20px 48px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(229, 50, 45, 0.35);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  border: none;
  user-select: none;
}

.btn-main-action:hover {
  background: var(--primary-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(229, 50, 45, 0.45);
}

.cloud-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-cloud {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary-red);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.btn-cloud:hover { transform: scale(1.08); }
.drop-hint { font-size: 14px; color: #9ca3af; }

/* РАБОЧАЯ ОБЛАСТЬ */
.workspace-section {
  display: flex;
  flex-grow: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  height: calc(100vh - 68px - 45px);
  overflow: hidden;
}

.workspace-left {
  flex-grow: 1;
  padding: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.file-cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.file-cards-header h3 { font-size: 20px; font-weight: 700; }

.btn-add-more {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.file-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.file-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.file-card-preview {
  width: 100%;
  height: 160px;
  background: #f8fafc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
}

.file-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-card-preview i { font-size: 48px; color: var(--primary-red); }

.file-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.file-card-remove:hover { background: var(--primary-red); }

/* Сайдбар */
.workspace-sidebar {
  width: 360px;
  background: var(--bg-white);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.03);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 { font-size: 18px; font-weight: 700; }

.sidebar-body {
  padding: 24px;
  flex-grow: 1;
  overflow-y: auto;
}

.setting-group { margin-bottom: 24px; }

.setting-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 10px;
  letter-spacing: 0.4px;
}

.toggle-buttons { display: flex; gap: 8px; }

.btn-toggle, .btn-toggle-margin, .btn-toggle-rotate {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-toggle.active, .btn-toggle-margin.active, .btn-toggle-rotate.active {
  background: #fef2f2;
  border-color: var(--primary-red);
  color: var(--primary-red);
}

.custom-select, .custom-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 14px;
  background: var(--bg-white);
  outline: none;
}

.custom-select:focus, .custom-input:focus { border-color: var(--primary-red); }

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
}

.btn-convert-final {
  width: 100%;
  background: var(--primary-red);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 6px 16px rgba(229, 50, 45, 0.3);
  transition: all 0.2s;
}

.btn-convert-final:hover {
  background: var(--primary-red-hover);
  transform: translateY(-2px);
}

/* РЕЗУЛЬТАТ */
.result-section {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.result-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.success-icon-wrap { font-size: 64px; color: #10b981; margin-bottom: 20px; }
.result-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.result-desc { font-size: 15px; color: var(--text-muted); margin-bottom: 24px; }

.compression-badge {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 10px 18px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.btn-download-big {
  background: var(--primary-red);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  padding: 18px 40px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(229, 50, 45, 0.3);
}

.btn-download-big:hover {
  background: var(--primary-red-hover);
  transform: translateY(-2px);
}

.result-batch-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 24px;
  max-height: 240px;
  overflow-y: auto;
}

.btn-link-restart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  margin-top: 28px;
  cursor: pointer;
}

.btn-link-restart:hover { color: var(--primary-red); }

/* PROGRESS MODAL */
.progress-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.progress-modal {
  background: var(--bg-white);
  padding: 32px 40px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}

.spinner-wheel { font-size: 36px; color: var(--primary-red); margin-bottom: 16px; }
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.progress-bar-fill { height: 100%; background: var(--primary-red); transition: width 0.15s ease; }

.footer {
  height: 45px;
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer p { font-size: 13px; color: var(--text-muted); }

.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1100;
}

.toast {
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--primary-red);
  animation: slideIn 0.3s ease;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 991px) {
  .btn-hamburger { display: block; }
  .nav-links { display: none; }
  .btn-text, .btn-register { display: none; }
  .navbar { height: 60px; }
  .nav-container { padding: 0 16px; }
  .hero-content h1 { font-size: 30px; }
  .hero-content p { font-size: 15px; margin-bottom: 24px; }
  .btn-main-action { font-size: 18px; padding: 16px 28px; width: 100%; max-width: 320px; }

  .workspace-section {
    flex-direction: column;
    height: auto;
    overflow-y: auto;
  }
  .workspace-left { padding: 16px; height: auto; }
  .file-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .workspace-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--border-color); }
  .sidebar-body { padding: 16px; }
  .sidebar-footer { padding: 16px; }
}


/* =========================================================================
   ИНТЕРАКТИВНЫЕ КАРТОЧКИ СТРАНИЦ И DRAG & DROP
   ========================================================================= */
.file-card {
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.file-card:active {
  cursor: grabbing;
}

.file-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  border: 2px dashed var(--primary-red);
}

.file-card.drag-over-left {
  border-left: 4px solid var(--primary-red) !important;
}

.file-card.drag-over-right {
  border-right: 4px solid var(--primary-red) !important;
}

.page-num-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  z-index: 2;
}

.card-actions-top {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 2;
}

.btn-card-action {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.2s, transform 0.15s;
}

.btn-card-action:hover {
  background: var(--primary-red);
  transform: scale(1.1);
}

.file-card-preview img {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКОВ */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 20px;
  padding: 2px;
  border: 1px solid var(--border-color);
}

.btn-lang {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-lang.active {
  background: var(--primary-red);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(229, 50, 45, 0.3);
}
