/* ==========================================================================
   Variables & Reset
   ========================================================================== */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container-width: 1200px;
}

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

html {
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--text-dark);
  background-color: var(--bg-body);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

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

ul {
  list-style: none;
}

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

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

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; color: var(--secondary); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }

/* ==========================================================================
   Layout & Components
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content {
  flex: 1;
  padding: 4rem 0;
}

/* Header */
.header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

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

.nav-links a {
  font-weight: 500;
  color: var(--secondary);
  transition: color 0.2s;
}

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

.nav-links a.active {
  color: var(--primary);
}

.mobile-menu-btn {
  min-height: 44px;
  display: none;
  padding: 0.5rem;
  color: var(--text-dark);
}

.mobile-menu {
  display: none;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu a {
  display: block;
  padding: 0.75rem 0;
  font-weight: 500;
  color: var(--secondary);
  border-bottom: 1px solid var(--border);
}

.mobile-menu a:last-child {
  border-bottom: none;
}

/* Buttons */
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s;
  text-align: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-body);
  color: var(--secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border);
  color: var(--text-dark);
}

.btn-danger {
  color: var(--danger);
  padding: 0.5rem;
  border-radius: var(--radius);
}

.btn-danger:hover:not(:disabled) {
  background-color: #fee2e2;
}

.btn-icon {
  min-height: 44px;
  padding: 0.5rem;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  border-radius: var(--radius);
  transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover:not(:disabled) {
  background-color: var(--border);
  color: var(--text-dark);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Tool Section */
.tool-section {
  max-width: 800px;
  margin: 0 auto 4rem;
}

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

/* Upload Area */
.upload-area {
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  background-color: var(--primary-light);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}

.upload-area:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

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

.upload-area input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  color: var(--primary);
}

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

/* File List Area */
.workspace-area {
  display: none;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2rem;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background-color: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.file-item:hover {
  border-color: var(--text-muted);
}

.file-icon {
  width: 24px;
  height: 24px;
  color: #ef4444; /* PDF Red */
  flex-shrink: 0;
  margin-right: 1rem;
}

.file-info {
  flex: 1;
  min-width: 0; /* for truncation */
}

.file-name {
  font-weight: 500;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

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

.file-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  flex-shrink: 0;
}

.file-order-controls {
  display: flex;
  flex-direction: column;
}

.file-order-controls button {
  padding: 0.5rem;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
}

.file-order-controls button:hover:not(:disabled) {
  color: var(--primary);
}

.file-order-controls button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.workspace-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Status Messages */
.status-message {
  display: none;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-weight: 500;
  text-align: center;
}

.status-error {
  background-color: #fee2e2;
  color: var(--danger-hover);
  border: 1px solid #f87171;
}

.status-success {
  background-color: #d1fae5;
  color: #047857;
  border: 1px solid #34d399;
}

/* Processing Overlay */
.processing-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Content Sections */
.content-section {
  max-width: 800px;
  margin: 0 auto 3rem;
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.content-section h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.content-section h2:first-child {
  margin-top: 0;
}

.content-section h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content-section ul, .content-section ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: var(--secondary);
}

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

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.feature-card {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.5rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.75rem;
  border-radius: 50%;
}

.feature-card h3 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

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

.faq-answer {
  color: var(--secondary);
  margin: 0;
}

/* Footer */
.footer {
  background-color: var(--text-dark);
  color: white;
  padding: 4rem 0 2rem;
  margin-top: auto;
}

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

.footer-brand .logo {
  color: white;
  margin-bottom: 1rem;
}

.footer-brand p {
  color: #94a3b8;
  font-size: 0.875rem;
}

.footer-heading {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

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

.footer-links a {
  color: #cbd5e1;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

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

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.tool-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

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

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.5rem;
  border-radius: var(--radius);
}

.tool-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

.tool-card-desc {
  color: var(--secondary);
  font-size: 0.875rem;
  margin: 0;
}

/* Breadcrumbs */
.breadcrumbs {
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--secondary);
}

.breadcrumbs a {
  color: var(--primary);
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs span {
  margin: 0 0.5rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0 2rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Utilities */
.mb-8 { margin-bottom: 2rem; }
.mt-8 { margin-top: 2rem; }
.text-danger { color: var(--danger); }

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  min-height: 44px;
  
  .hero h1 { font-size: 2.5rem; }
  
  .content-section {
    padding: 1.5rem;
  }
  
  .workspace-actions {
    flex-direction: column-reverse;
  }
  
  .workspace-actions .btn {
  min-height: 44px;
    width: 100%;
  }
  
  .file-item {
    flex-wrap: wrap;
  }
  
  .file-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 1rem;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2rem; }
  .upload-area { padding: 3rem 1rem; }
}
