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

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --secondary: #ec4899;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg-light: #fefefe;
  --bg-gradient: linear-gradient(135deg, #fdf4ff 0%, #ecfeff 50%, #fff7ed 100%);
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --shadow: 0 10px 40px rgba(99, 102, 241, 0.15);
  --shadow-hover: 0 20px 60px rgba(236, 72, 153, 0.25);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  padding-bottom: 100px;
}

/* Fun Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(245, 158, 11, 0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* Ad Banners */
.ad-banner {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.ad-top {
  min-height: 90px;
}

.ad-content {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  min-height: 250px;
  background: transparent;
  border: none;
}

.ad-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05)) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  cursor: default;
  border-radius: 20px;
}

.ad-card:hover {
  transform: none;
  box-shadow: none;
}

.ad-sticky-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.95), rgba(253,244,255,0.95));
  backdrop-filter: blur(20px);
  min-height: 60px;
  z-index: 999;
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  min-height: 600px;
  background: var(--card-bg);
  border-radius: 20px;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow);
}

@media (min-width: 1400px) {
  .ad-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s;
  padding: 0.5rem 1rem;
  border-radius: 10px;
}

.nav-links a:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Hero */
.hero {
  text-align: center;
  padding: 5rem 2rem;
  background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.03));
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '📄✨';
  position: absolute;
  font-size: 8rem;
  opacity: 0.1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hero-image {
  max-width: 400px;
  width: 80%;
  height: auto;
  margin-bottom: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease infinite;
  background-size: 200% 200%;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.tool-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 2rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s;
}

.tool-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: var(--shadow-hover);
  border-color: rgba(99, 102, 241, 0.2);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card.coming-soon {
  opacity: 0.5;
  pointer-events: none;
}

.tool-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
}

.tool-icon-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 1rem;
}

.tool-card h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 4rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.feature {
  padding: 2rem;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 5px 20px rgba(99, 102, 241, 0.08);
  transition: all 0.3s;
}

.feature:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-icon-img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.feature h3 {
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text);
}

.feature p {
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.05));
  color: var(--text-muted);
}

.footer-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Tool Page Layout */
.tool-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

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

.tool-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Drop Zone */
.drop-zone {
  border: 3px dashed var(--primary);
  border-radius: 24px;
  padding: 4rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, 
    rgba(99, 102, 241, 0.1) 0%, 
    rgba(236, 72, 153, 0.1) 50%, 
    rgba(245, 158, 11, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--secondary);
  transform: scale(1.02);
  box-shadow: 0 20px 60px rgba(236, 72, 153, 0.2);
}

.drop-zone:hover::before,
.drop-zone.dragover::before {
  opacity: 1;
}

.drop-zone-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.drop-zone-text {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.drop-zone-hint {
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.file-input {
  display: none;
}

/* Files List */
.files-list {
  margin-top: 1.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  margin-bottom: 0.75rem;
  animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.file-icon {
  font-size: 1.75rem;
}

.file-name {
  font-weight: 600;
  color: var(--text);
}

.file-size {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-remove {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.2));
  border: none;
  color: var(--danger);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.3s;
}

.file-remove:hover {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  transform: scale(1.1);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 1.25rem 2rem;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-top: 1.5rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 50px rgba(236, 72, 153, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(16, 185, 129, 0.4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Processing */
.processing {
  display: none;
  text-align: center;
  padding: 3rem;
}

.processing.show {
  display: block;
}

.spinner {
  width: 70px;
  height: 70px;
  border: 5px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

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

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: 28px;
  padding: 2.5rem;
  max-width: 600px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 80px rgba(99, 102, 241, 0.3);
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  margin-bottom: 1rem;
  font-size: 1.75rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ad-container {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1rem 0;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 2px dashed rgba(99, 102, 241, 0.2);
}

.ad-container-large {
  min-height: 600px;
}

.countdown {
  font-size: 5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 1rem 0;
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.countdown-text {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 6px;
  margin: 1rem 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  border-radius: 6px;
  transition: width 1s linear;
  background-size: 200% 100%;
  animation: gradientMove 2s linear infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Page Selector (for Split) */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.page-thumb {
  aspect-ratio: 3/4;
  background: var(--card-bg);
  border: 3px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.1);
}

.page-thumb:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.page-thumb.selected {
  border-color: var(--secondary);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(99, 102, 241, 0.1));
  transform: scale(1.05);
}

/* Compression Options */
.options-group {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.option-btn {
  flex: 1;
  min-width: 120px;
  padding: 1.25rem;
  background: var(--card-bg);
  border: 3px solid transparent;
  border-radius: 16px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.1);
}

.option-btn:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}

.option-btn.selected {
  border-color: var(--secondary);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(99, 102, 241, 0.1));
}

.option-btn strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.option-btn span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Signature Canvas */
.signature-container {
  margin-top: 1.5rem;
}

.signature-canvas {
  width: 100%;
  height: 200px;
  background: white;
  border-radius: 16px;
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
  border: 2px solid rgba(99, 102, 241, 0.2);
}

.signature-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.signature-actions button {
  flex: 1;
  padding: 0.875rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-clear {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.2));
  color: var(--danger);
}

.btn-clear:hover {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

/* PDF Preview */
.pdf-preview {
  margin-top: 1.5rem;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  max-height: 400px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.pdf-page-preview {
  background: white;
  margin-bottom: 1rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.pdf-page-preview canvas {
  width: 100%;
  height: auto;
}

/* Inline Ad */
.ad-inline {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(99, 102, 241, 0.15);
}

/* Language Switcher */
.lang-switcher select {
  background: var(--card-bg);
  color: var(--text);
  border: 2px solid rgba(99, 102, 241, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s;
}

.lang-switcher select:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

/* SEO Content */
.seo-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.seo-content h2 {
  color: var(--text);
  margin-bottom: 1rem;
  font-weight: 700;
}

.seo-content h3 {
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
  font-weight: 600;
}

.seo-content ul {
  margin-left: 1.5rem;
}

.seo-content li {
  margin-bottom: 0.5rem;
}

/* Fun decorative elements */
.tool-page::before {
  content: '✨';
  position: fixed;
  top: 100px;
  right: 50px;
  font-size: 2rem;
  opacity: 0.3;
  animation: float 3s ease-in-out infinite;
  pointer-events: none;
}

.tool-page::after {
  content: '🎉';
  position: fixed;
  bottom: 150px;
  left: 50px;
  font-size: 2rem;
  opacity: 0.3;
  animation: float 3s ease-in-out infinite 1s;
  pointer-events: none;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .tool-page {
    padding: 1rem;
  }

  .drop-zone {
    padding: 2rem 1rem;
  }

  .modal {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .ad-top {
    min-height: 50px;
  }
  
  .ad-sticky-bottom {
    min-height: 50px;
  }
  
  .tool-page::before,
  .tool-page::after {
    display: none;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(99, 102, 241, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}
