/* ==========================================================================
   iLovePDF Style PDF Split & Unmerge Studio Stylesheet
   Sumit Chauhan Branding & Responsive Layout
   ========================================================================== */

:root {
  --ilove-red: #e5322d;
  --ilove-red-hover: #cb1c17;
  --ilove-red-active: #b11612;
  --ilove-gray-bg: #f4f5f8;
  --ilove-card-bg: #ffffff;
  --ilove-border: #e2e8f0;
  --ilove-text-main: #1a1a1a;
  --ilove-text-muted: #64748b;
  --ilove-sidebar-bg: #ffffff;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Montserrat', sans-serif;
}

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

body.ilove-body {
  background-color: var(--ilove-gray-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: #1e293b;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   BRAND HEADER & BADGE STYLING
   ========================================================================== */
.brand-header-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.2px;
  margin: 0;
  line-height: 1.15;
}

.brand-header-title .brand-name {
  font-size: 1.15rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-header-title .brand-sep {
  color: #cbd5e1;
  font-weight: 300;
  font-size: 1.1rem;
  margin: 0 2px;
}

.brand-header-title .tool-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: #c2410c;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.06);
}

@media (max-width: 768px) {
  .brand-header-title {
    gap: 4px;
  }
  .brand-header-title .brand-name {
    font-size: 0.95rem;
  }
  .brand-header-title .tool-badge-pill {
    font-size: 0.7rem;
    padding: 2px 7px;
  }
}

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */
.ilove-tool-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ==========================================================================
   STAGE 1: HERO & UPLOAD STAGE
   ========================================================================== */
.ilove-hero-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 3rem 1.5rem;
  min-height: calc(100vh - 160px);
}

.ilove-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  color: #181b22;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.ilove-hero-subtitle {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: #4b5563;
  max-width: 720px;
  margin-bottom: 2.5rem;
  line-height: 1.45;
  font-weight: 400;
}

/* Big Red Select Button + Cloud Stack */
.ilove-upload-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.ilove-main-btn {
  background-color: var(--ilove-red);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  padding: 1.25rem 2.8rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(229, 50, 45, 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ilove-main-btn:hover {
  background-color: var(--ilove-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(229, 50, 45, 0.45);
}

.ilove-main-btn:active {
  background-color: var(--ilove-red-active);
  transform: translateY(0);
}

.ilove-cloud-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ilove-cloud-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--ilove-red);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(229, 50, 45, 0.25);
  transition: all 0.2s ease;
}

.ilove-cloud-btn:hover {
  background-color: var(--ilove-red-hover);
  transform: scale(1.08);
}

.ilove-drop-hint {
  font-size: 0.95rem;
  color: #64748b;
  font-weight: 500;
}

/* ==========================================================================
   STAGE 2: WORKSPACE STAGE (PAGES GRID & SIDEBAR)
   ========================================================================== */
.ilove-workspace-stage {
  flex: 1;
  display: flex;
  min-height: calc(100vh - 120px);
  background: #f1f3f7;
  position: relative;
}

.ilove-canvas-area {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Workspace Top Bar */
.workspace-top-bar {
  width: 100%;
  max-width: 980px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 10px;
}

.doc-info-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.meta-dot {
  color: #94a3b8;
}

.ws-selection-actions {
  display: flex;
  gap: 8px;
}

.ws-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.ws-tool-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  transform: translateY(-1px);
}

/* PDF Pages Grid */
.pdf-pages-grid {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  padding-bottom: 2rem;
}

/* Page Card Item */
.page-card-item {
  background: #ffffff;
  border-radius: 12px;
  border: 2px solid transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  padding: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.page-card-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.page-card-item.is-selected {
  border-color: var(--ilove-red);
  background: #fff5f5;
  box-shadow: 0 4px 15px rgba(229, 50, 45, 0.15);
}

.page-card-num {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e293b;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.page-card-item.is-selected .page-card-num {
  background: var(--ilove-red);
}

/* Page Card Checkbox */
.page-card-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: transparent;
  transition: all 0.2s ease;
  z-index: 4;
}

.page-card-item.is-selected .page-card-checkbox {
  background: var(--ilove-red);
  border-color: var(--ilove-red);
  color: #ffffff;
}

/* Thumbnail Box */
.page-card-thumb-wrap {
  width: 100%;
  aspect-ratio: 1 / 1.35;
  background: #f8fafc;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
}

.page-card-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.page-card-label {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.page-card-item.is-selected .page-card-label {
  color: var(--ilove-red);
}

.workspace-reorder-hint {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 1rem;
}

/* ==========================================================================
   RIGHT ACTION SIDEBAR
   ========================================================================== */
.ilove-action-sidebar {
  width: 380px;
  background: var(--ilove-sidebar-bg);
  border-left: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.04);
  z-index: 100;
}

.sidebar-header {
  padding: 2rem 1.8rem 1.25rem 1.8rem;
  border-bottom: 1px solid #f1f5f9;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 0.4rem;
}

.sidebar-subtitle {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.4;
}

.sidebar-form-panel {
  padding: 1.8rem;
  flex: 1;
  overflow-y: auto;
}

/* Mode Selector Cards */
.split-mode-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-card:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.mode-card.active {
  border-color: var(--ilove-red);
  background: #fffafa;
}

.mode-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--ilove-red);
}

.mode-card-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-card-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}

.mode-card-desc {
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.35;
}

.ilove-input-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.5rem;
}

.ilove-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ilove-input:focus {
  border-color: var(--ilove-red);
  box-shadow: 0 0 0 3px rgba(229, 50, 45, 0.15);
}

.merge-summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #475569;
}

.summary-row strong {
  color: #0f172a;
  font-weight: 700;
}

.sidebar-footer {
  padding: 1.5rem 1.8rem;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}

.ilove-action-btn {
  width: 100%;
  background: var(--ilove-red);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 1.1rem 1.5rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(229, 50, 45, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ilove-action-btn:hover {
  background: var(--ilove-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(229, 50, 45, 0.45);
}

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

/* ==========================================================================
   STAGE 3: PROCESSING OVERLAY
   ========================================================================== */
.ilove-processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.processing-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.processing-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #f1f5f9;
  border-top-color: var(--ilove-red);
  border-radius: 50%;
  margin: 0 auto 1.5rem auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.processing-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.processing-desc {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.4;
}

/* ==========================================================================
   STAGE 4: SUCCESS / DOWNLOAD STAGE
   ========================================================================== */
.ilove-success-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 3rem 1.5rem;
  min-height: calc(100vh - 160px);
}

.success-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
}

.success-stage-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.success-stage-subtitle {
  font-size: 1.05rem;
  color: #64748b;
  margin-bottom: 2.25rem;
  max-width: 560px;
}

.success-action-cluster {
  margin-bottom: 2rem;
}

.ilove-download-btn {
  background: var(--ilove-red);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  padding: 1.25rem 3rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(229, 50, 45, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ilove-download-btn:hover {
  background: var(--ilove-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 16px 35px rgba(229, 50, 45, 0.5);
}

.success-sub-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.sub-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.4rem;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-action-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  transform: translateY(-1px);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.ilove-footer {
  background: transparent;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   RESPONSIVE LAYOUT
   ========================================================================== */
@media (max-width: 900px) {
  .ilove-workspace-stage {
    flex-direction: column;
  }
  
  .ilove-action-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid #e5e7eb;
  }

  .ilove-hero-title {
    font-size: 1.85rem;
  }

  .ilove-main-btn {
    font-size: 1.15rem;
    padding: 1rem 1.8rem;
  }
}
