/* ===========================
   DocLite Global Design System
   World-Class Professional UI
   =========================== */

:root {
  /* Primary Palette - Trustworthy & Modern */
  --color-primary: #4F46E5; /* Indigo 600 */
  --color-primary-hover: #4338CA; /* Indigo 700 */
  --color-secondary: #0EA5E9; /* Sky 500 */
  --color-accent: #F59E0B; /* Amber 500 */
  
  /* Neutrals */
  --color-bg: #F8FAFC; /* Slate 50 */
  --color-surface: #FFFFFF;
  --color-text-main: #0F172A; /* Slate 900 */
  --color-text-muted: #64748B; /* Slate 500 */
  --color-border: #E2E8F0; /* Slate 200 */
  
  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #4F46E5 0%, #0EA5E9 100%);
  --gradient-surface: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  
  /* Shadows - Layered & Soft */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Spacing & Layout */
  --container-width: 1280px;
  --header-height: 70px;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ===========================
   Reset & Base
   =========================== */

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

img {
  max-width: 100%;
  display: block;
}

/* ===========================
   Navbar
   =========================== */

.navbar {
  height: auto;
  min-height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.5rem 0;
}

.navbar-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text-main);
  text-decoration: none;
}

.navbar-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.navbar-menu {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.navbar-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.navbar-link:hover,
.navbar-link.active {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .navbar-container {
    flex-wrap: wrap;
    padding: 1rem;
  }
  
  .navbar-toggle {
    display: block;
  }
  
  .navbar-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
  }

  .navbar-menu.active {
    display: flex;
  }
}

/* Mobile Menu Toggle */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-main);
  cursor: pointer;
  padding: 0.5rem;
}

/* ===========================
   Hero Section
   =========================== */

.hero {
  position: relative;
  padding: 2.5rem 1.5rem; /* Reduced from 4rem */
  text-align: center;
  background: var(--color-surface);
  overflow: hidden;
}

.hero-with-bg {
  background: linear-gradient(135deg, #EEF2FF 0%, #F0F9FF 100%);
  position: relative;
  overflow: hidden;
}

.hero-with-bg::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(79, 70, 229, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(14, 165, 233, 0.1) 0px, transparent 50%);
  z-index: 0;
}

.hero-with-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2364748b' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: 0;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2; /* Tighter line height */
  margin-bottom: 1rem; /* Reduced from 1.5rem */
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem; /* Reduced from 2.5rem */
  line-height: 1.6;
}

@media (max-width: 768px) {
  .hero {
    padding: 1.5rem 1rem; /* Reduced from 2rem */
  }
  
  .hero-title {
    font-size: 2rem; /* Fallback */
    font-size: clamp(1.75rem, 7vw, 2.5rem); /* Slightly smaller */
  }
}

/* ===========================
   Grid System (3-4 Columns)
   =========================== */

.tools-section, .related-tools-section {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-title, .related-tools-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--color-text-main);
}

.tools-category {
  margin-bottom: 4rem;
}

.category-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.category-icon {
  color: var(--color-primary);
}

.tools-grid, .related-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* Default 4 columns */
  gap: 1.5rem;
}

.tool-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (max-width: 1024px) {
  .tools-grid, .related-tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .tools-grid, .related-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tool-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .tools-grid, .related-tools-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 0.75rem; /* Smaller gap */
  }
  
  .tool-card {
    padding: 1rem; /* Smaller padding */
  }
  
  .tool-card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }
  
  .tool-card-title {
    font-size: 0.9rem;
  }
  
  .tool-card-description {
    font-size: 0.75rem;
    line-height: 1.3;
  }
}

/* ===========================
   Tool Cards
   =========================== */

.tool-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  height: 100%;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.tool-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

.tool-card-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===========================
   Tool Page Specifics
   =========================== */

.tool-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem; /* Reduced top padding further */
}

.tool-header {
  text-align: center;
  margin-bottom: 1.5rem; /* Reduced from 2rem */
}

.tool-header-icon {
  width: 64px; /* Reduced from 80px */
  height: 64px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--color-primary);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem; /* Reduced from 2.5rem */
  margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.upload-area {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 1.5rem; /* Reduced padding */
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover {
  border-color: var(--color-primary);
  background: #F1F5F9;
}

@media (max-width: 768px) {
  .tool-page {
    padding: 1rem 0.75rem; /* Tighter on mobile */
    overflow-x: hidden; /* Prevent horizontal scroll */
  }
  
  .upload-area {
    padding: 1.5rem 1rem;
  }
  
  .tool-header-icon {
    width: 56px;
    height: 56px;
    font-size: 1.75rem;
  }
}

/* ===========================
   Buttons
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.5rem;
  border: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-text-muted);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* ===========================
   Footer
   =========================== */

.footer {
  background: #1E293B;
  color: #94A3B8;
  padding: 4rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: var(--container-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
}

.footer-column h3 {
  color: white;
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-link {
  display: block;
  margin-bottom: 0.75rem;
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: white;
}

@media (max-width: 768px) {
  .footer-container {
    gap: 2rem;
  }
}

/* Footer Social */
.footer-social {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transition: all 0.2s;
  font-size: 1.25rem;
  text-decoration: none;
}

.social-link:hover {
  background: var(--color-primary);
  transform: translateY(-3px);
  color: white;
}

.footer-bottom {
  border-top: 1px solid #334155;
  margin-top: 3rem;
  padding-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
}

/* ===========================
   Utilities
   =========================== */

.hidden { display: none !important; }
.text-center { text-align: center; }
.mb-5 { margin-bottom: 3rem; }

/* Ad Slot */
.ad-slot {
  background: #F1F5F9;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 2rem auto;
  max-width: 728px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ===========================
   Component Styles (Added)
   =========================== */

/* Upload Area Internals */
.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.upload-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
}

.upload-subtext {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  word-wrap: break-word; /* Allow wrapping */
  overflow-wrap: break-word;
  max-width: 100%;
}

/* File List */
.file-list {
  margin-top: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.file-list-header {
  padding: 1rem 1.5rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-list-title {
  font-weight: 600;
  color: var(--color-text-main);
}

.file-items-grid {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 1024px) {
  .file-items-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .file-items-grid {
    grid-template-columns: 1fr;
  }
}

.file-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  gap: 1rem;
}

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

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Controls */
.controls {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.control-group {
  margin-bottom: 1.5rem;
}

.control-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

.control-select, .control-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  background: white;
}

.control-select:focus, .control-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.control-slider {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.control-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (max-width: 1024px) {
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

.result-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}

.result-thumbnail {
  max-width: 100%;
  height: 150px;
  object-fit: contain;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.result-filename {
  font-weight: 600;
  margin-bottom: 1rem;
  word-break: break-all;
}

/* ===========================
   Typography & Content Restoration
   =========================== */

/* 1. Root Level Elements (Direct children of body) 
   These need side padding because body has none by default */
body > h2, 
body > h3, 
body > p, 
body > ul, 
body > ol,
body > [id^="ezoic-pub-ad-placeholder"] {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-sizing: border-box;
}

/* 2. Tool Page Elements (Inside .tool-page)
   These DO NOT need side padding because .tool-page already has it.
   We just center them and limit width. */
.tool-page > h2,
.tool-page > h3,
.tool-page > p,
.tool-page > ul,
.tool-page > ol,
.tool-page > [id^="ezoic-pub-ad-placeholder"] {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
}

/* Allow top ad to be wider if needed, but centered */
body > #ezoic-pub-ad-placeholder-101 {
    max-width: var(--container-width);
}

/* Headings */
body > h2, .tool-page > h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 1.5rem; /* Reduced from 2rem */
    margin-bottom: 1rem;
    color: var(--color-text-main);
    text-align: center;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.75rem;
}

body > h3, .tool-page > h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem; /* Reduced from 1.5rem */
    margin-bottom: 0.75rem;
    color: var(--color-text-main);
}

/* Paragraphs */
body > p, .tool-page > p {
    margin-bottom: 0.75rem; /* Reduced from 1rem */
    line-height: 1.6;
    color: var(--color-text-muted);
}

/* Lists */
body > ul, body > ol {
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
    list-style-position: outside;
    padding-left: 2rem; /* Standard padding */
}

.tool-page > ul, .tool-page > ol {
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
    list-style-position: outside;
    padding-left: 2rem; /* Increased from 1.25rem for better bullet spacing */
    margin-left: 0; /* Reset margin */
}

body > ul li, .tool-page > ul li,
body > ol li, .tool-page > ol li {
    margin-bottom: 0.5rem;
}

body > ul li strong, .tool-page > ul li strong,
body > ol li strong, .tool-page > ol li strong {
    color: var(--color-text-main);
}

/* FAQ Items - Global Styling */
.faq-item {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.faq-question {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
}

.faq-answer {
    color: var(--color-text-muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* FAQ Section Container */
.faq-section {
    max-width: 800px;
    margin: 2rem auto; /* Reduced from 2.5rem */
}

.faq-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-text-main);
}

/* Ezoic Ad Placeholders */
[id^="ezoic-pub-ad-placeholder"] {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.5rem auto; /* Reduced from 1rem */
    min-height: 90px; /* Reduced from 100px */
    width: 100%;
    overflow: hidden;
    padding: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    body > h2, .tool-page > h2 {
        font-size: 1.35rem;
        margin-top: 1rem; /* Reduced from 1.5rem */
    }
    
    /* Root elements padding on mobile */
    body > h2, 
    body > h3, 
    body > p, 
    body > ul, 
    body > ol {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Tool page elements padding on mobile - keep 0 */
    .tool-page > h2,
    .tool-page > h3,
    .tool-page > p,
    .tool-page > ul,
    .tool-page > ol {
        padding-left: 0;
        padding-right: 0;
    }
    
    body > ul, body > ol,
    .tool-page > ul, .tool-page > ol {
        padding-left: 1.5rem; /* Tighter but sufficient for mobile */
    }

    [id^="ezoic-pub-ad-placeholder"] {
        min-height: 100px; /* Reduced from 250px to fix huge gaps */
        margin: 0.5rem auto; /* Minimal margin */
    }
    
    .related-tools-section {
        padding: 1.5rem 1rem;
    }
    
    .faq-item {
        padding: 1rem;
    }
}

