/*
 * PDF Hub by Krudevtech — Design system
 * Deep Navy / Blue / White / Light Gray · Bootstrap 5 overrides
 */
:root {
    --navy-900: #071530;
    --navy-800: #0b1f3a;
    --navy-700: #12305a;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;
    --gray-50: #f6f8fb;
    --gray-100: #eef1f6;
    --gray-200: #dfe4ec;
    --gray-500: #6b7686;
    --gray-700: #36404f;
    --success: #12805c;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(11, 31, 58, .06), 0 1px 3px rgba(11, 31, 58, .08);
    --shadow-md: 0 8px 24px rgba(11, 31, 58, .10);
    --bs-primary: var(--blue-600);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Sarabun", Tahoma, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: var(--gray-700);
    --bs-body-bg: var(--gray-50);
    --bs-link-color: var(--blue-600);
}

html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
h1, h2, h3, h4, h5 { color: var(--navy-800); font-weight: 700; letter-spacing: -.01em; }
.btn-primary { --bs-btn-bg: var(--blue-600); --bs-btn-border-color: var(--blue-600); --bs-btn-hover-bg: #1d4fd0; --bs-btn-hover-border-color: #1d4fd0; --bs-btn-active-bg: #1a45b8; --bs-btn-disabled-bg: var(--blue-600); }
.btn-outline-primary { --bs-btn-color: var(--blue-600); --bs-btn-border-color: var(--blue-600); --bs-btn-hover-bg: var(--blue-600); --bs-btn-active-bg: var(--blue-600); }
.btn-success { --bs-btn-bg: var(--success); --bs-btn-border-color: var(--success); --bs-btn-hover-bg: #0e6c4d; --bs-btn-hover-border-color: #0e6c4d; }
.form-control:focus, .form-select:focus, .btn:focus-visible, .dropzone:focus-visible {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .22);
    outline: 0;
}
.skip-link { position: absolute; left: 8px; top: 8px; z-index: 2000; background: #fff; padding: .5rem .75rem; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header { background: var(--navy-800); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.site-header .navbar { padding-top: .6rem; padding-bottom: .6rem; }
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); color: #fff; font-size: 1.05rem;
}
.brand-text strong { font-size: 1.15rem; letter-spacing: -.01em; }
.brand-text small { font-size: .72rem; opacity: .7; margin-left: .15rem; font-weight: 400; }
.site-header .nav-link { color: rgba(255, 255, 255, .78); font-weight: 500; }
.site-header .nav-link:hover, .site-header .nav-link.active { color: #fff; }
.header-status { margin-top: .5rem; }
@media (min-width: 992px) { .header-status { margin-top: 0; } }
.usage-badge { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 500; padding: .5rem .75rem; border-radius: 999px; }
.usage-badge.usage-empty { background: #b45309; }
.admin-badge { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1f1300; font-weight: 700; letter-spacing: .04em; padding: .5rem .75rem; border-radius: 999px; }

/* ---------- Hero ---------- */
.hero {
    background: radial-gradient(1200px 400px at 50% -10%, rgba(59, 130, 246, .35), transparent 60%), linear-gradient(180deg, var(--navy-800), var(--navy-700));
    color: #fff;
    padding: 3.5rem 0 5.5rem;
}
.hero-title { color: #fff; font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 800; margin-bottom: .25rem; }
.hero-title small { font-size: .38em; font-weight: 500; opacity: .7; letter-spacing: 0; }
.hero-sub { font-size: 1.15rem; font-weight: 600; color: var(--blue-100); margin-bottom: .5rem; letter-spacing: .02em; }
.hero-text { max-width: 640px; margin: 0 auto 1.25rem; color: rgba(255, 255, 255, .78); }
.hero-quota {
    display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .25rem;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px; padding: .5rem 1.1rem; font-size: .92rem;
}
.hero-quota-sep { opacity: .5; margin: 0 .35rem; }

/* ---------- Tool cards (dashboard) ---------- */
.tools-grid-wrap { margin-top: -3rem; position: relative; }
.tool-card-link { display: block; text-decoration: none; color: inherit; height: 100%; }
.tool-card-item {
    background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.4rem;
    box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    display: flex; flex-direction: column; align-items: flex-start;
}
.tool-card-link:hover .tool-card-item, .tool-card-link:focus-visible .tool-card-item { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--blue-500); }
.tool-card-link:focus-visible { outline: 0; }
.tool-card-link.is-unavailable .tool-card-item { opacity: .85; }
.tool-icon {
    width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: var(--blue-600); background: var(--blue-50); margin-bottom: 1rem;
}
.tool-desc { color: var(--gray-700); font-weight: 500; }
.tool-desc-th { color: var(--gray-500); font-size: .9rem; }
.tool-go { margin-top: auto; padding-top: 1rem; color: var(--blue-600); font-weight: 600; font-size: .92rem; }
.tool-card-item h3 { margin-bottom: .35rem; }

/* ---------- Privacy / features ---------- */
.privacy-section { margin-top: 2.5rem; margin-bottom: 3rem; }
.privacy-card {
    display: flex; gap: 1rem; align-items: flex-start; background: #fff; border: 1px solid var(--gray-200);
    border-left: 4px solid var(--blue-600); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow-sm);
}
.privacy-icon { color: var(--blue-600); font-size: 1.5rem; line-height: 1.2; }
.feature-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem 2rem; margin: 1.5rem 0 0; color: var(--gray-500); font-size: .92rem; }
.feature-row i { color: var(--blue-600); margin-right: .4rem; }

/* ---------- Tool page ---------- */
.tool-hero { background: linear-gradient(180deg, var(--navy-800), var(--navy-700)); color: #fff; padding: 1.5rem 0 3.25rem; }
.tool-hero h1 { color: #fff; }
.tool-hero .breadcrumb { --bs-breadcrumb-divider-color: rgba(255, 255, 255, .5); --bs-breadcrumb-item-active-color: rgba(255, 255, 255, .8); font-size: .88rem; }
.tool-hero .breadcrumb a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.tool-hero-icon {
    width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem; background: rgba(255, 255, 255, .12); color: #fff; flex: none;
}
.tool-container { margin-top: -1.75rem; padding-bottom: 3rem; position: relative; }
.tool-card { border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.options-grid .form-label { font-size: .92rem; }

/* ---------- Dropzone / file list ---------- */
.dropzone {
    border: 2px dashed #b9c4d6; border-radius: var(--radius); background: var(--gray-50); text-align: center;
    padding: 2rem 1rem; cursor: pointer; transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone.is-drag { background: var(--blue-50); border-color: var(--blue-500); }
.dropzone-icon { font-size: 2.2rem; color: var(--blue-600); }
.dropzone-title { font-weight: 700; color: var(--navy-800); margin-top: .35rem; }
.dropzone-hint { color: var(--gray-500); font-size: .88rem; }
.dropzone.is-compact { padding: 1rem; }
.dropzone.is-compact .dropzone-icon { font-size: 1.4rem; display: inline-block; margin-right: .5rem; vertical-align: middle; }
.dropzone.is-compact .dropzone-title { display: inline-block; margin: 0; }
.dropzone.is-compact .dropzone-hint, .dropzone.is-compact .btn { display: none; }
.uploader.is-locked .dropzone { opacity: .55; cursor: not-allowed; }

.file-list { margin: 1rem 0 0; display: flex; flex-direction: column; gap: .5rem; }
.file-item {
    display: flex; align-items: center; gap: .75rem; background: #fff; border: 1px solid var(--gray-200);
    border-radius: 12px; padding: .55rem .7rem;
}
.file-thumb { width: 44px; height: 44px; flex: none; border-radius: 8px; background: var(--blue-50); color: var(--blue-600); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 1.25rem; }
.file-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.file-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 600; color: var(--navy-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: .8rem; color: var(--gray-500); }
.file-actions { display: flex; gap: .3rem; flex: none; }
.file-order { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--navy-800); color: #fff; font-size: .78rem; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.drag-handle { cursor: grab; color: var(--gray-500); padding: .25rem; touch-action: none; }
.drag-ghost { opacity: .45; background: var(--blue-50); }

/* รูปภาพ: แสดงเป็นกริดการ์ดใหญ่ */
.file-list.is-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.file-list.is-images .file-item { flex-direction: column; align-items: stretch; position: relative; padding: .5rem; }
.file-list.is-images .file-thumb { width: 100%; height: 120px; font-size: 2rem; }
.file-list.is-images .file-actions { justify-content: center; }
.file-list.is-images .file-order { position: absolute; top: .75rem; left: .75rem; box-shadow: var(--shadow-sm); }
.file-list.is-images .drag-handle { position: absolute; top: .65rem; right: .65rem; background: rgba(255, 255, 255, .9); border-radius: 6px; z-index: 1; }

/* ---------- Option cards ---------- */
.option-card {
    display: flex; gap: .85rem; align-items: center; height: 100%; padding: .85rem 1rem; background: #fff; cursor: pointer;
    border: 1px solid var(--gray-200); border-radius: 12px; transition: border-color .15s, background .15s;
}
.option-card > i { font-size: 1.25rem; color: var(--blue-600); width: 1.5rem; text-align: center; }
.option-card strong { display: block; color: var(--navy-800); }
.option-card small { display: block; color: var(--gray-500); }
.btn-check:checked + .option-card { border-color: var(--blue-600); background: var(--blue-50); box-shadow: 0 0 0 1px var(--blue-600) inset; }
.btn-check:focus-visible + .option-card { box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .22); }

/* ---------- Progress / result ---------- */
.progress-panel { margin-top: 1.5rem; padding: 1rem 1.1rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 12px; }
.progress-bar { background-color: var(--blue-600); }
.result-panel { margin-top: 1.5rem; }
.result-card { border: 1px solid #bfe6d6; background: #f3fbf7; border-radius: var(--radius); padding: 1.25rem; }
.result-head { display: flex; gap: .85rem; align-items: center; }
.result-icon { width: 46px; height: 46px; border-radius: 12px; background: #d6f3e6; color: var(--success); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex: none; }
.result-stats { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 1rem 0 0; }
.result-stats dt { font-weight: 500; color: var(--gray-500); }
.result-stats dd { margin: 0; font-weight: 600; color: var(--navy-800); }
.gallery-item { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: .5rem; height: 100%; display: flex; flex-direction: column; gap: .5rem; }
.gallery-thumb { border: 0; padding: 0; background: var(--gray-100); border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.gallery-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gallery-meta { display: flex; justify-content: space-between; align-items: baseline; padding: 0 .15rem; }
form.is-busy { pointer-events: none; opacity: .7; }

/* ---------- Admin / misc ---------- */
.admin-wrap { padding: 3rem 0 4rem; }
.code-box { background: var(--navy-800); color: #e6edf7; border-radius: 10px; padding: 1rem; overflow-x: auto; font-size: .85rem; user-select: all; }
.req-tool { display: flex; gap: .85rem; align-items: flex-start; background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: .9rem 1rem; height: 100%; }
.req-tool > i { font-size: 1.2rem; margin-top: .2rem; }
.req-tool.is-ok { border-left: 4px solid var(--success); }
.req-tool.is-ok > i { color: var(--success); }
.req-tool.is-bad { border-left: 4px solid #d97706; }
.req-tool.is-bad > i { color: #d97706; }
.req-table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); }

/* ---------- Footer ---------- */
.site-footer { flex-shrink: 0; background: var(--navy-900); color: rgba(255, 255, 255, .72); padding: 1.6rem 0; margin-top: 2rem; font-size: .9rem; }
.footer-brand { color: #fff; font-weight: 700; }
.footer-dev { opacity: .75; }

@media (max-width: 575.98px) {
    .hero { padding-top: 2.5rem; }
    .result-stats { grid-template-columns: 1fr; gap: 0; }
    .result-stats dd { margin-bottom: .5rem; }
    .file-list.is-images { grid-template-columns: repeat(2, 1fr); }
    .tool-container { margin-top: -1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Captcha ---------- */
.captcha-img { border: 1px solid var(--gray-200); border-radius: 8px; background: #f1f5fb; max-width: 100%; height: auto; }

/* ---------- SEO content ---------- */
.seo-content { margin-top: 2.5rem; color: var(--gray-700); line-height: 1.7; }
.seo-content h2 { margin-top: 1.25rem; }
.seo-steps { padding-left: 1.25rem; }
.seo-steps li { margin-bottom: .35rem; }
.seo-features { list-style: none; padding: 0; margin: 0; }
.seo-features li { margin-bottom: .4rem; }
.seo-features i { color: var(--success); margin-right: .4rem; }
.seo-home { margin-bottom: 1rem; }
.seo-home-list { padding-left: 1.1rem; }
.seo-home-list a { text-decoration: none; }
.seo-faq .accordion-button { font-weight: 600; color: var(--navy-800); }
.seo-faq .accordion-button:not(.collapsed) { background: var(--blue-50); }
.related-tools { display: flex; flex-wrap: wrap; gap: .5rem .75rem; }
.related-tools a { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--gray-200); background: #fff; border-radius: 999px; text-decoration: none; font-size: .9rem; }
.related-tools a:hover { border-color: var(--blue-500); }
