/* 1. RESET & VARIABLES – light theme (match Quick Image Fix homepage) */
:root {
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --primary: #667eea;
    --accent: #764ba2;
    --text-primary: #2d3748;
    --text-gray: #4a5568;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Quick Image Fix header & footer (match Image Rotator & Flipper page) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: #667eea;
  color: white;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 1rem;
  outline: 2px solid #764ba2;
  outline-offset: 2px;
}

.header {
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  color: #2d3748;
}

.nav-link {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  color: #2d3748;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: #667eea; background: rgba(102, 126, 234, 0.08); }
.nav-link-active { color: #667eea !important; font-weight: 600; background: rgba(102, 126, 234, 0.1); }

.dropdown-menu { z-index: 60; }
.dropdown-item { white-space: nowrap; }

/* Mobile menu: class .is-open controls visibility (reliable on all devices) */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  visibility: hidden;
}
.mobile-menu.is-open {
  z-index: 9999;
  pointer-events: auto;
  visibility: visible;
}
.mobile-menu .mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s;
}
.mobile-menu.is-open .mobile-overlay {
  opacity: 1;
}
.mobile-menu .mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  z-index: 1;
}
.mobile-menu.is-open .mobile-drawer {
  transform: translateX(0);
}
.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-header .close-mobile {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.5rem;
  cursor: pointer;
  color: #2d3748;
  border-radius: 0.5rem;
}
.mobile-drawer-header .close-mobile:hover {
  background: #f7fafc;
}
.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 1rem;
}
.mobile-nav-list li {
  margin: 0;
}
.mobile-nav-list a {
  display: block;
  padding: 0.75rem 1rem;
  color: #2d3748;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 500;
}
.mobile-nav-list a:hover {
  background: #f7fafc;
  color: #667eea;
}
.mobile-nav-list a.mobile-nav-active {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  font-weight: 600;
}

/* Hamburger: proper icon and touch target */
.hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2d3748;
}
.hamburger-svg {
  display: block;
  width: 24px;
  height: 24px;
}
@media (max-width: 767px) {
  .hamburger {
    min-width: 44px;
    min-height: 44px;
  }
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-color);
    min-height: 100vh;
    line-height: 1.6;
}

/* 2. LAYOUT */
.main-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px;
    width: 100%;
}

@media (max-width: 640px) {
    .main-wrapper {
        padding: 24px 16px;
    }
}

/* 3. HERO SECTION */
.hero-section {
    text-align: center;
    margin-bottom: 50px;
}

@media (max-width: 640px) {
    .hero-section {
        margin-bottom: 32px;
    }
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(to right, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 10px;
    }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-gray);
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .hero-subtitle {
        font-size: 1rem;
        padding: 0 8px;
    }
}

.highlight { color: var(--primary); font-weight: 600; }

/* 4. TOOL CARD */
.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 60px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    text-align: center;
    overflow-x: hidden;
}

@media (max-width: 640px) {
    .tool-card {
        padding: 20px 16px;
        margin-bottom: 40px;
        border-radius: 16px;
    }
}

/* Upload area (functional tool) */
.upload-placeholder {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    background: #f7fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

@media (max-width: 640px) {
    .upload-placeholder {
        padding: 24px 16px;
    }
}

.upload-placeholder:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.06);
}

.upload-placeholder.dragover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.upload-placeholder .icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.upload-placeholder h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.upload-placeholder p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.upload-placeholder .uploadMeta {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-bottom: 12px;
    word-break: break-word;
}

.upload-btn {
    margin-top: 10px;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}

.upload-btn:hover { opacity: 0.9; }

/* Status line */
.status {
    margin-top: 14px;
    min-height: 20px;
    color: var(--text-gray);
    font-size: 0.95rem;
    text-align: left;
    white-space: pre-line;
    word-break: break-word;
}

.status.error {
    color: #c53030;
}

/* Batch bar */
.batchBar {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .batchBar {
        padding: 12px;
        gap: 12px;
    }
}

.batchLeft {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .batchLeft {
        gap: 10px;
    }
}

.progressText {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.fieldLabel {
    font-size: 0.8rem;
    color: var(--text-gray);
    font-weight: 600;
}

.select {
    appearance: none;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
}

.formatGroup {
    border: 0;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.formatRadios {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.formatLabel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-gray);
    cursor: pointer;
}

.formatLabel input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.batchActions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .batchActions {
        width: 100%;
        justify-content: stretch;
    }
    .batchActions .btn {
        flex: 1;
        min-width: 0;
    }
}

/* Buttons */
.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary {
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
}

.btn.primary:hover:not(:disabled) {
    opacity: 0.9;
}

@media (max-width: 640px) {
    .btn {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
}

.footerActions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .footerActions {
        justify-content: stretch;
    }
    .footerActions .btn {
        width: 100%;
    }
}

/* Thumbnail grid */
.thumbGrid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 760px) {
    .thumbGrid {
        grid-template-columns: 1fr 1fr;
    }
}

.thumbCard {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
}

.thumbHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 480px) {
    .thumbHeader {
        padding: 8px 10px;
        gap: 8px;
    }
}

.thumbName {
    font-weight: 700;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    min-width: 0;
}

.thumbStatus {
    color: var(--text-gray);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 999px;
    background: #edf2f7;
}

.thumbStatus.error {
    color: #c53030;
    background: #fed7d7;
}

.thumbBody {
    padding: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

@media (min-width: 760px) {
    .thumbBody {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.thumbBody > .thumbRowLabel {
    grid-column: 1 / -1;
    margin-top: -2px;
}

p.thumbRowLabel {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin: 0 0 6px;
    font-weight: 700;
}

.thumbImg {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    background: #edf2f7;
    border: 1px solid var(--border);
}

.thumbFooter {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

/* Scoped so header nav (hidden md:flex) is not overridden */
#tool-container .hidden,
.thumbGrid.hidden,
.batchBar.hidden {
    display: none !important;
}

/* 5. FEATURES GRID */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

@media (max-width: 640px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 32px;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.feature-box {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .feature-box {
        padding: 18px;
    }
}

.feature-box h3 { color: var(--text-primary); margin-bottom: 10px; font-size: 1.1rem; }
.feature-box p { color: var(--text-gray); font-size: 0.95rem; }

/* 6. CONTENT & FAQ STYLING */
.content-section {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.divider { border: 0; height: 1px; background: var(--border); margin: 50px 0; }

@media (max-width: 640px) {
    .divider {
        margin: 32px 0;
    }
}

.text-block h2, .faq-section h2 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .text-block h2, .faq-section h2 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }
}

.text-block p, .text-block li {
    color: var(--text-gray);
    margin-bottom: 15px;
    font-size: 1.05rem;
}

@media (max-width: 640px) {
    .text-block p, .text-block li {
        font-size: 1rem;
        margin-bottom: 12px;
    }
}

.text-block ol {
    padding-left: 24px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .text-block ol {
        padding-left: 20px;
    }
}

/* FAQ SPECIFIC */
.faq-section {
    margin-top: 40px;
}

@media (max-width: 640px) {
    .faq-section {
        margin-top: 28px;
    }
}

.faq-item {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 640px) {
    .faq-item {
        margin-bottom: 18px;
        padding-bottom: 18px;
    }
}

.faq-item:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    color: var(--text-primary);
    font-size: 1.15rem;
    margin-bottom: 10px;
}

@media (max-width: 640px) {
    .faq-item h3 {
        font-size: 1.05rem;
    }
}

.faq-item p { color: var(--text-gray); }

/* 7. FOOTER (page footer is Tailwind in HTML; these only if .site-footer used) */
.site-footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border);
    margin-top: 80px;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.site-footer p {
    margin-bottom: 10px;
}

.footer-links { margin-top: 10px; }
.footer-links a {
    color: var(--text-gray);
    text-decoration: none;
    margin: 0 10px;
}
.footer-links a:hover { color: var(--primary); }

/* ========== RESPONSIVE: GLOBAL ========== */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal overflow */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

/* Footer responsive padding (matches Tailwind py-12 px-6 on desktop) */
@media (max-width: 640px) {
    body > footer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}
