/* =========================================================
   MASTER STYLESHEET (Image Cut)
   Updated: With Sticky Dropdown, Floating Nav, Carousel, & Badge Hero
   ========================================================= */

/* --- 1. Global Variables & Base --- */
:root {
  --accent: #a6c1ee;
  --accent-glow: #fbc2eb;
  --bg-dark: #000000;
  --bg-deep: #0a0e27;
  --bg-panel: rgba(255, 255, 255, 0.08);
  --bg-panel-light: rgba(255, 255, 255, 0.1);
  --muted: #c9c9c9;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html {
  min-height: 100%; 
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  
  /* Option 3: Spotlight Background */
  background: radial-gradient(circle at center top, #1e2952 0%, var(--bg-deep) 60%, var(--bg-dark) 100%);
  background-attachment: fixed;
  background-size: cover;
  
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }

/* --- 2. Navigation (Floating + Sticky Dropdown Fix) --- */
.top-nav {
  position: fixed; 
  top: 20px; /* Floating from top */
  left: 50%;
  transform: translateX(-50%); 
  
  /* Wide Floating Capsule */
  width: calc(100% - 40px); 
  max-width: none; 
  border-radius: 16px; 
  
  /* Glass Effect */
  background: rgba(10, 14, 39, 0.75); 
  backdrop-filter: blur(16px); 
  border: 1px solid rgba(255, 255, 255, 0.08); 
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); 
  
  padding: 10px 25px; 
  display: flex; 
  justify-content: space-between;
  align-items: center; 
  z-index: 1000; 
}

.logo { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; transition: transform 0.25s ease; }
.logo:hover { transform: translateY(-2px) scale(1.02); text-decoration: none; }
.logo img { height: 32px; width: auto; border-radius: 6px; }
.logo-text { font-size: 1rem; font-weight: 600; color: #fff; }

.nav-buttons {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 5px; 
  margin: 0;
}

/* Default Button State */
.nav-btn {
  background: transparent; 
  border: 2px solid var(--accent); 
  color: #fff;
  padding: 6px 14px; 
  border-radius: 30px; 
  font-size: 0.85rem; 
  font-weight: 600;
  cursor: pointer; 
  white-space: nowrap; 
  transition: all 0.25s ease;
  box-shadow: none; 
  display: inline-flex; 
  align-items: center; 
  gap: 6px;
  text-decoration: none;
}

.nav-btn:hover {
  background: var(--accent); 
  color: var(--bg-deep);
  transform: translateY(-2px); 
  box-shadow: 0 6px 20px rgba(166,193,238,0.6); 
  text-decoration: none;
  border-color: var(--accent);
}

.nav-btn.active { 
  background: var(--accent); 
  color: var(--bg-deep); 
  box-shadow: 0 0 15px rgba(166,193,238,0.4); 
  border-color: var(--accent);
}

/* --- Dropdown Menu (The Sticky Fix) --- */
.nav-dropdown {
  position: relative;
  display: inline-block;
  /* Extends hover area downwards so you don't lose the menu in the gap */
  padding-bottom: 20px; 
  margin-bottom: -20px; 
}

.dropdown-menu {
  /* Use Visibility/Opacity for transitions (Display:none can't animate) */
  visibility: hidden;
  opacity: 0;
  
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  
  /* THE FIX: 0.5s Delay before disappearing */
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  transition-delay: 0.5s; 
}

/* The Invisible Bridge (Fills the gap) */
.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: transparent; 
}

/* Hover State */
.nav-dropdown:hover .dropdown-menu {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  
  /* Reset delay to 0s when entering so it opens instantly */
  transition-delay: 0s;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.dropdown-item i { color: var(--accent); width: 20px; text-align: center; }

.dropdown-item:hover {
  background: var(--accent);
  color: var(--bg-deep);
  text-decoration: none;
}
.dropdown-item:hover i { color: var(--bg-deep); }


/* --- 3. Buttons & Inputs (Shared) --- */
.btn-primary, .tool-btn, #convertButton, #compressButton, #downloadButton, button.action {
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  border: none; color: var(--bg-deep); padding: 10px 18px; border-radius: 12px;
  font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  transition: all 0.2s ease; font-size: 1rem;
}
.btn-primary:hover, .tool-btn:hover, #convertButton:hover, #compressButton:hover, button.action:hover {
  box-shadow: 0 8px 30px rgba(166,193,238,0.45); transform: translateY(-3px);
}
.btn-primary[disabled], button[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: transparent; border: 1px solid rgba(255,255,255,0.15); color: #fff;
  padding: 10px 14px; border-radius: 12px; cursor: pointer; transition: all 0.2s ease;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.file-input-button {
  display: inline-block; padding: 12px 20px; border-radius: 10px;
  background: linear-gradient(90deg, #1a1a2e, #16213e); color: #fff; font-size: 0.9rem;
  cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border: none; margin-top: 10px;
}
.file-input-button:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

/* --- 4. Layout Containers --- */
main.homepage, main.tool-page { flex: 1 0 auto; max-width: 980px; margin: 110px auto 40px; padding: 0 18px; box-sizing: border-box; width: 100%; }
main.text-page { max-width: 850px; margin: 140px auto 60px; padding: 0 24px; line-height: 1.7; color: #e0e0e0; }

.intro-section { text-align: center; margin: 30px auto 30px; max-width: 700px; }
.intro-section h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 10px; color: #fff; }
.intro-section p { color: var(--muted); font-size: 1rem; }
.intro-content {
  max-width: 820px;
  margin: -30px auto 40px;
  text-align: center;
  color: #ddd;
  font-size: 1rem;
  line-height: 1.6;
  padding: 0 20px;
}

.container {
  background: var(--bg-panel); backdrop-filter: blur(10px); border-radius: 20px;
  padding: 30px; box-shadow: var(--shadow-soft); border: 1px solid rgba(255,255,255,0.1);
  text-align: center; margin: 20px auto; max-width: 800px; width: 100%;
}
.container h1 { font-size: 1.8rem; margin-bottom: 20px; font-weight: 700; color: #fff; }

.upload-area, .drop-zone {
  border: 2px dashed rgba(255,255,255,0.2); border-radius: 16px; padding: 40px 20px;
  text-align: center; background: rgba(255,255,255,0.02); transition: 0.2s ease;
  cursor: pointer; margin: 20px auto;
}
.upload-area.dragover, .drop-zone.dragover {
  background: rgba(255,255,255,0.08); border-color: var(--accent); transform: scale(1.01);
}
.upload-area i, .drop-zone i { font-size: 3rem; color: var(--accent); margin-bottom: 15px; display: block; }

/* --- 5. Homepage Specifics (Sticker Badge Style) --- */

.hero {
  text-align: center;
  padding: 80px 20px 40px;
  max-width: 800px;
  margin: auto;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 25px;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  animation: fadeSlideUp 1s ease-out;
}

.hero-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: #0a0e27;
  padding: 5px 25px;
  border-radius: 12px;
  transform: rotate(-3deg);
  box-shadow: 0 10px 25px rgba(166, 193, 238, 0.5);
  display: inline-block;
  transition: transform 0.3s ease;
}

.hero-badge:hover {
  transform: rotate(0deg) scale(1.05);
}

.hero p {
  font-size: 1.2rem;
  color: #d1d5db;
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto;
  animation: fadeSlideUp 1.2s ease-out;
}

.hero p strong { color: var(--accent); font-weight: 600; }

@keyframes fadeSlideUp { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

/* --- Infinite Carousel Styles --- */
.carousel-window {
  width: 100%;
  overflow: hidden;
  position: relative;
  margin: 40px auto;
  padding: 40px 0; 
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.carousel-track {
  display: flex;
  gap: 30px;
  width: max-content;
  animation: scrollLeft 30s linear infinite;
}

.carousel-track:hover { animation-play-state: paused; }

@keyframes scrollLeft {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Tool Card Styles (Carousel Ready) */
.tool-card {
  flex: 0 0 280px; 
  width: 280px;
  background: var(--bg-panel); 
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px; 
  text-align: center; 
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  user-select: none;
}

.tool-card:hover {
  transform: scale(1.1) translateY(-10px);
  box-shadow: 0 15px 35px rgba(166,193,238,0.25);
  background: var(--bg-panel-light);
  z-index: 10;
  border-color: var(--accent);
}

.tool-card i { font-size: 2rem; color: var(--accent); margin-bottom: 15px; display: block; }
.tool-card h3 { margin-bottom: 10px; color: #fff; font-size: 1.2rem; }
.tool-card p { color: #ccc; font-size: 0.9rem; margin-bottom: 20px; line-height: 1.5; }

/* SEO Content & Features */
.content-info { 
  margin: 60px auto; text-align: center; max-width: 800px; padding: 0 20px; opacity: 0; 
  animation: fadeSlideUp 0.8s ease-out forwards; 
  animation-delay: 0.5s;
}
.content-info h2 { color: var(--accent); margin-bottom: 15px; }
.content-info p { color: #ccc; line-height: 1.6; margin-bottom: 20px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 30px; }
.feature { background: rgba(255,255,255,0.05); padding: 20px; border-radius: 12px; text-align: center; }
.feature i { font-size: 1.5rem; color: var(--accent); margin-bottom: 10px; }

/* FAQ Section */
.faq {
  max-width: 800px;
  margin: 60px auto 100px;
  text-align: left;
  padding: 0 24px;
}
.faq h2 { text-align: center; color: var(--accent); margin-bottom: 30px; }
.faq-item {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(5px);
  margin-bottom: 16px;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.faq-item h3 { margin: 0 0 8px 0; color: #fff; font-size: 1.1rem; }
.faq-item p { color: #ccc; font-size: 0.95rem; line-height: 1.6; margin: 0; }
.faq details { background: rgba(255,255,255,0.04); border-radius: 12px; margin-bottom: 10px; padding: 15px; }
.faq summary { font-weight: 600; cursor: pointer; outline: none; }
.faq details p { margin-top: 10px; color: #ccc; font-size: 0.95rem; }


/* --- 6. Text Pages (About & Privacy) --- */
.text-page h1 { text-align: center; margin-bottom: 40px; font-size: 2.2rem; }
.text-page h2 { color: var(--accent); margin-top: 40px; font-size: 1.4rem; }
.text-page p, .text-page ul { margin-bottom: 20px; color: #d0d0d0; }
.text-page li { margin-bottom: 10px; }

.text-page h1, .text-page h2, .text-page p, .text-page ul {
  opacity: 0; 
  animation: fadeSlideUp 0.8s ease-out forwards;
}

.text-page h1 { animation-delay: 0.1s; }
.text-page > p:first-of-type { animation-delay: 0.2s; }
.text-page h2 { animation-delay: 0.3s; }
.text-page p:not(:first-of-type) { animation-delay: 0.4s; }

/* --- 7. Size Compressor Styles --- */
.file-list { margin-top: 20px; max-height: 300px; overflow-y: auto; }
.file-row { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 10px; margin-bottom: 10px; text-align: left; }
.thumb { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; background: #111; flex-shrink: 0; }
.meta { flex: 1; min-width: 0; }
.meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.meta .muted { font-size: 0.85rem; color: #aaa; margin-top: 4px; }

.results-area { margin-top: 20px; }
.result-row { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,0.05); padding: 12px; border-radius: 10px; margin-bottom: 10px; text-align: left; }
.progress { height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; margin-top: 15px; width: 100%; }
.progress > i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.3s ease; }

/* --- 8. Tool Controls --- */
.tool-controls { display: flex; flex-direction: column; align-items: center; gap: 15px; margin-top: 20px; }
.tool-controls select, .tool-controls input[type="number"] {
  padding: 12px 16px; border-radius: 10px; border: none; background: linear-gradient(90deg, #1a1a2e, #16213e);
  color: #fff; font-weight: 600; width: 100%; max-width: 300px; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  appearance: none; -webkit-appearance: none;
}
.tool-controls select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='white' stroke-width='2' viewBox='0 0 24 24'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 15px center; background-size: 16px;
}
.tool-controls .small-inputs { display: flex; gap: 10px; justify-content: center; width: 100%; max-width: 300px; }
.tool-controls .small-inputs input { width: 100%; }
.preview-container { margin-top: 20px; text-align: center; }
.preview-container img { max-width: 100%; max-height: 300px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.4); display: none; margin: 0 auto; }

/* --- 9. PDF Specifics --- */
.preview-item { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); padding: 10px; border-radius: 8px; margin-bottom: 8px; text-align: left; }
.preview-item .icon-holder { width: 50px; height: 50px; flex-shrink: 0; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.preview-item .file-meta { flex: 1; font-size: 0.9rem; }
.preview-item .remove-btn { background: none; border: none; color: #ff6b6b; cursor: pointer; font-size: 1.2rem; padding: 0 10px; }

/* --- 10. Footer --- */
footer {
  background: rgba(10, 14, 39, 0.95); backdrop-filter: blur(10px); color: #bbbbbb; font-size: 0.9rem; text-align: center; padding: 40px 20px; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: auto;
}
footer p { margin: 10px 0; line-height: 1.8; }
footer a { color: var(--accent); text-decoration: none; margin: 0 20px; font-weight: 500; display: inline-block; }
footer a:hover { text-decoration: underline; color: #fff; }
.privacy-footer { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(10,14,39,0.95); padding: 8px; font-size: 0.75rem; text-align: center; z-index: 2000; border-top: 1px solid rgba(255,255,255,0.05); }
.privacy-footer i { color: var(--accent); margin-right: 5px; font-size: 0.8rem; }

/* --- 11. Responsive --- */
@media (max-width: 768px) {
  .top-nav {
    top: 10px;
    width: calc(100% - 20px);
    padding: 10px 15px;
    flex-direction: column; 
    align-items: flex-start;
    gap: 10px;
  }
  
  .nav-buttons { 
    width: 100%;
    overflow-x: auto; 
    justify-content: flex-start; 
    padding: 10px 5px; 
    margin: 0;
  }
  
  .nav-dropdown { 
    position: static; 
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .nav-btn { font-size: 0.8rem; padding: 5px 12px; }
  .logo { width: 100%; justify-content: center; margin-bottom: 5px; }

  main.homepage, main.tool-page { margin-top: 130px; }
  
  /* Mobile adjustments for New Badge Hero */
  .hero h1 { font-size: 2.8rem; }
  .hero-badge { padding: 2px 15px; margin-top: 5px; }
  
  .container { padding: 20px; }
  .tool-controls select, .tool-controls input { max-width: 100%; }
  footer a { display: block; margin: 8px 0; }
  
  .carousel-track { animation-duration: 20s; }
  .tool-card { flex: 0 0 240px; width: 240px; }
  
  /* Mobile Editor Adjustments */
  .toolbar { flex-direction: column; align-items: stretch; gap: 15px; }
  .tool-group { justify-content: space-between; overflow-x: auto; white-space: nowrap; padding-bottom: 10px; }
  .action-group { margin-left: 0; justify-content: stretch; }
  .action-group .btn { flex: 1; text-align: center; padding: 12px; }
  .image-stage { height: 50vh; }
}

/* --- 12. Cookie Banner --- */
.cookie-banner { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 600px; background: rgba(10, 14, 39, 0.95); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.1); padding: 20px; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.4); display: none; z-index: 10000; text-align: center; }
.cookie-banner p { margin: 0 0 15px; font-size: 0.9rem; color: #ccc; }
.cookie-actions { display: flex; gap: 10px; justify-content: center; }

/* --- 13. Image Cropper Specifics --- */
.cropper-wrapper { width: 100%; display: flex; flex-direction: column; }
.editor-section { width: 100%; background: #000000; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 20px rgba(0,0,0,0.8); border: 1px solid rgba(255,255,255,0.1); display: none; }
.image-stage { height: 60vh; width: 100%; background-image: linear-gradient(45deg, #111 25%, transparent 25%), linear-gradient(-45deg, #111 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #111 75%), linear-gradient(-45deg, transparent 75%, #111 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px; display: flex; align-items: center; justify-content: center; }
.image-stage img { max-width: 100%; display: block; }

.toolbar { background: var(--bg-deep); padding: 15px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: center; }
.tool-group { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.03); padding: 6px 12px; border-radius: 30px; border: 1px solid rgba(255,255,255,0.05); }
.tool-group span { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; margin-right: 5px; letter-spacing: 0.5px; }
.toolbar .btn { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; }
.toolbar .btn:hover { background: var(--accent); color: var(--bg-deep); border-color: var(--accent); transform: translateY(-1px); }
.action-group { margin-left: auto; display: flex; gap: 10px; }
.toolbar .btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent-glow)); border: none; color: var(--bg-deep); font-weight: 700; box-shadow: 0 4px 15px rgba(166,193,238,0.2); }
.toolbar .btn-primary:hover { box-shadow: 0 6px 20px rgba(166,193,238,0.4); transform: translateY(-2px); }

/* Cropper Overrides */
.cropper-view-box { outline: 2px solid var(--accent) !important; }
.cropper-point { background-color: var(--accent) !important; width: 8px !important; height: 8px !important; }
.cropper-line { background-color: var(--accent) !important; }
.cropper-modal { background-color: #000; opacity: 0.6; }