/* ==========================================================================
   DOCUFLUX DESIGN SYSTEM - MODERN, RESPONSIVE, ACCESSIBLE (WCAG 2.1 AA)
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Light Theme */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #475569;
  --nav-bg: rgba(255, 255, 255, 0.95);
  --nav-border: #e2e8f0;

  /* Primary Brand Accent */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-text: #1d4ed8;

  /* Status Colors */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;

  --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);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-body: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #1a2234;
  --bg-input: #1e293b;
  --border-color: #1f293d;
  --border-focus: #60a5fa;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  --nav-bg: rgba(17, 24, 39, 0.95);
  --nav-border: #1f293d;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: rgba(59, 130, 246, 0.3);
  --primary-text: #93c5fd;

  --success: #34d399;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.15);

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-body);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-body);
  color: var(--text-main);
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
}

p {
  color: var(--text-sub);
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* 44px Minimum Touch Targets */
button, input, select, textarea, .btn, .nav-link {
  min-height: 44px;
  font-family: inherit;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

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

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

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-sm {
  min-height: 38px;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-lg {
  min-height: 52px;
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
}

/* Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
  transition: all 0.2s ease;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}

.desktop-nav {
  display: none;
}

@media (min-width: 860px) {
  .desktop-nav {
    display: flex;
    align-items: center;
  }
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Dropdown Mega Menu */
.nav-dropdown-item {
  position: relative;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  z-index: 60;
  animation: fadeIn 0.2s ease-in-out;
}

.nav-dropdown-item:hover .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-link {
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: background-color 0.15s;
}

.dropdown-link:hover {
  background-color: var(--bg-card-hover);
}

.dropdown-link strong {
  font-size: 0.875rem;
  color: var(--text-main);
}

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

/* Mobile Hamburger & Drawer */
.mobile-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.35rem;
  cursor: pointer;
}

@media (min-width: 860px) {
  .mobile-hamburger {
    display: none;
  }
}

.desktop-auth-btn {
  display: none;
}

@media (min-width: 640px) {
  .desktop-auth-btn {
    display: inline-flex;
  }
}

.mobile-drawer {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

/* Theme Toggle Button */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}

.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--border-focus);
}

/* Hero Section */
.hero-section {
  padding: 3.5rem 0 2rem;
  text-align: center;
  background: radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.5rem;
  }
}

.hero-subtitle {
  font-size: 1.125rem;
  max-width: 680px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* Search Bar */
.search-wrapper {
  max-width: 620px;
  margin: 0 auto 2.5rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1.25rem 0.875rem 3.25rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.search-icon {
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.category-tab-btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}

.category-tab-btn:hover, .category-tab-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.25rem;
  margin-bottom: 4rem;
}

@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (min-width: 1280px) {
  .tools-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Tool Card */
.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

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

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

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.tool-category-badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.tool-open-btn {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Tool Workbench */
.tool-workbench {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 640px) {
  .tool-workbench {
    padding: 1.25rem;
  }
}

/* Drop Zone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--bg-card-hover);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  position: relative;
}

.dropzone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.dropzone-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.dropzone-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Files Selected List */
.file-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.file-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Controls & Options Bar */
.tool-options-bar {
  background-color: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
  flex: 1;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9375rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
}

/* Progress and Processing UX */
.processing-box {
  background-color: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.progress-bar-container {
  width: 100%;
  height: 12px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  width: 0%;
  transition: width 0.2s ease;
  border-radius: var(--radius-full);
}

.progress-status-text {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.progress-eta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.dont-leave-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background-color: var(--warning-bg);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 1rem;
}

.speed-explainer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding: 0.5rem;
  border-top: 1px dashed var(--border-color);
}

/* Limit Notice Modal & Alert */
.limit-alert {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.limit-alert-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.limit-alert-body {
  font-size: 0.875rem;
  color: #78350f;
  line-height: 1.5;
}

/* Success Download Result */
.download-result-box {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
  border: 2px solid var(--success);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  margin: 1.5rem 0;
}

.download-result-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: var(--radius-full);
  background-color: var(--success-bg);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  z-index: 100;
  display: none;
}

.cookie-banner.show {
  display: block;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Site Footer */
.site-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-col-title {
  font-size: 0.9375rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-link {
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: color 0.15s;
}

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

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
  }
}

/* Utility Classes */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
