/* ==========================================================================
   PDFJPG App Shell — approved redesign (2026-08)
   Loaded AFTER styles.css; overrides the legacy look and adds the app shell
   (sidebar + topbar) injected by js/app-shell.js.
   ========================================================================== */

:root {
    --as-accent: #2563eb;
    --as-accent-hover: #1d4ed8;
    --as-accent-soft: #eff6ff;
    --as-text: #1e293b;
    --as-muted: #64748b;
    --as-border: #e2e8f0;
    --as-bg: #f3f6fc;
    --as-green: #16a34a;
    --as-red: #ef4444;
}

/* ---------- base ---------- */
/* the border-box reset lived in the legacy styles.css; rebuilt pages need it here */
body.app-shell, body.app-shell *, body.app-shell *::before, body.app-shell *::after {
    box-sizing: border-box;
}

body.app-shell {
    font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
        'Segoe UI', 'Malgun Gothic', sans-serif !important;
    background: var(--as-bg) !important;
    color: var(--as-text) !important;
    -webkit-font-smoothing: antialiased;
    padding-left: 212px;
    padding-top: 60px;
}

/* kill legacy decorations */
body.app-shell .floating-elements,
body.app-shell .header,
body.app-shell .tool-header { display: none !important; }

/* ---------- injected sidebar ---------- */
.as-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 212px; z-index: 1000;
    background: #fff; border-right: 1px solid var(--as-border);
    display: flex; flex-direction: column; padding: 16px 14px 14px;
}
.as-sidebar > * { flex-shrink: 0; } /* short windows must not squash items */
.as-logo {
    display: flex; align-items: center; gap: 0; text-decoration: none;
    margin: 2px 0 22px 2px;
}
.as-logo .as-logo-sq {
    width: 46px; height: 46px; border-radius: 14px;
    background: conic-gradient(from 45deg, #f43f5e, #f97316, #eab308, #22c55e, #3b82f6, #a855f7, #f43f5e);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 0.7rem; letter-spacing: -0.03em;
    box-shadow: 0 3px 10px rgba(15,23,42,.14);
}
.as-logo .as-logo-sq span { background: #fff; color: var(--as-text); border-radius: 7px; padding: 3px 5px; }
.as-item {
    display: flex; align-items: center; gap: 13px; width: 100%;
    padding: 12px 14px; border: none; background: none; border-radius: 11px;
    color: #475569; font-size: 0.94rem; font-weight: 600; text-align: left;
    text-decoration: none; position: relative; margin-bottom: 3px; cursor: pointer;
    transition: background .15s, color .15s;
}
.as-item i { font-size: 1rem; width: 20px; text-align: center; }
.as-item:hover { background: #f1f5f9; color: #475569; }
.as-item.active {
    background: #dbeafe; color: #1d4ed8; font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .14);
}
.as-item.active i { color: #1d4ed8; }
.as-item.active::before {
    content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 28px; border-radius: 0 4px 4px 0; background: var(--as-accent);
}
/* smallpdf-style flyout submenu: hover a category to see its tools */
.as-item-wrap { position: relative; }
.as-item-wrap .as-item { width: 100%; }
.as-flyout {
    display: none;
    position: absolute; left: 100%; top: -6px; z-index: 1200;
    min-width: 230px; max-height: calc(100vh - 24px); overflow-y: auto;
    background: #0f172a; border-radius: 12px; padding: 8px;
    /* transparent border doubles as the hover bridge across the gap */
    border-left: 8px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .35);
}
.as-item-wrap:hover .as-flyout,
.as-item-wrap:focus-within .as-flyout,
.as-flyout:hover { display: block; }
/* lower categories anchor to the bottom so tall lists stay on screen */
.as-item-wrap:nth-last-of-type(-n+2) .as-flyout { top: auto; bottom: -6px; }
.as-flyout a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: 8px;
    color: #e2e8f0; font-size: 0.86rem; font-weight: 600; text-decoration: none;
    white-space: nowrap;
}
.as-flyout a:hover { background: #1e293b; color: #fff; }
.as-flyout .fchip {
    width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.7rem;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .2);
}
.as-flyout::-webkit-scrollbar { width: 8px; }
.as-flyout::-webkit-scrollbar-thumb { background: #334155; border-radius: 99px; }

.as-spacer { flex: 1; }
.as-divider { height: 1px; background: var(--as-border); margin: 10px 2px 12px; }
.as-secure {
    display: flex; align-items: center; gap: 9px; padding: 10px 12px;
    font-size: 0.72rem; font-weight: 600; color: var(--as-muted); line-height: 1.4;
}
.as-secure i { color: var(--as-green); font-size: 0.9rem; }

/* ---------- injected topbar ---------- */
.as-topbar {
    position: fixed; top: 0; left: 212px; right: 0; height: 60px; z-index: 999;
    background: #fff; border-bottom: 1px solid var(--as-border);
    display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.as-topbar .as-title {
    font-size: 1.1rem !important; font-weight: 800 !important; letter-spacing: -0.02em;
    color: var(--as-text) !important; margin: 0 !important;
    min-width: 0; flex-shrink: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-topbar .as-tspacer { flex: 1; }
.as-back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--as-border); border-radius: 9px;
    background: #fff; color: #475569; font-size: 0.9rem; text-decoration: none;
    transition: background .15s;
}
.as-back:hover { background: #f8fafc; color: #475569; }

/* existing language selector, restyled as topbar pill */
.as-topbar .language-selector { position: relative; }
.as-topbar .lang-btn {
    display: flex !important; align-items: center; gap: 8px;
    border: 1px solid var(--as-border) !important; border-radius: 999px !important;
    padding: 8px 15px !important; background: #fff !important;
    font-size: 0.85rem !important; font-weight: 600 !important; color: var(--as-text) !important;
    box-shadow: none !important; cursor: pointer;
}
.as-topbar .lang-btn:hover { border-color: #cbd5e1 !important; }
.as-topbar .lang-btn .fa-globe { color: var(--as-accent); }
.as-topbar .lang-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px;
    background: #fff !important; border: 1px solid var(--as-border) !important;
    border-radius: 12px !important; box-shadow: 0 12px 32px rgba(15,23,42,.14) !important;
    padding: 6px !important; z-index: 1001;
}
/* i18n.js toggles .active — the show/hide rules lived in the legacy styles.css,
   which the rebuilt pages no longer load. Define them here. */
body.app-shell .lang-dropdown { display: none !important; }
body.app-shell .lang-dropdown.active { display: block !important; }
.as-topbar .lang-option {
    display: flex !important; align-items: center; gap: 10px;
    padding: 8px 11px !important; border-radius: 8px !important;
    font-size: 0.875rem !important; color: var(--as-text) !important; text-decoration: none;
}
.as-topbar .lang-option:hover { background: var(--as-accent-soft) !important; color: var(--as-accent) !important; }
.as-topbar .lang-option.active { background: var(--as-accent-soft) !important; color: var(--as-accent) !important; }

/* ==========================================================================
   REBUILT HOMEPAGE (new markup, styles.css NOT loaded on these pages)
   ========================================================================== */

body.as-home { margin: 0; }
body.as-home h1, body.as-home h2, body.as-home h3, body.as-home p, body.as-home ul { margin: 0; padding: 0; }
body.as-home ul { list-style: none; }
body.as-home a { text-decoration: none; }

.as-main { max-width: 1180px; margin: 0 auto; padding: 44px 32px 40px; }

/* hero */
.as-hero { margin-bottom: 30px; }
.as-hero .hero-title {
    font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em;
    color: var(--as-text); margin-bottom: 7px;
}
.as-hero .hero-subtitle { font-size: 0.95rem; color: var(--as-muted); }
.as-secure-pill {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
    padding: 8px 15px; background: #fff; border: 1px solid var(--as-border);
    border-radius: 999px; font-size: 0.8rem; color: var(--as-muted);
}
.as-secure-pill i { color: var(--as-green); font-size: 0.8rem; }

/* filter pills */
.category-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.filter-btn {
    padding: 8px 18px; border-radius: 999px; border: 1px solid var(--as-border);
    background: #fff; font-size: 0.875rem; font-weight: 600; color: var(--as-muted);
    cursor: pointer; font-family: inherit; transition: all .15s;
}
.filter-btn:hover { border-color: #cbd5e1; color: var(--as-text); }
.filter-btn.active { background: var(--as-accent); border-color: var(--as-accent); color: #fff; }

/* tool cards (new markup: .tool-card > .tc-inner > .tool-chip + .tc-body) */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.tool-card {
    display: block; background: #fff; border: 1px solid var(--as-border);
    border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.tool-card:hover { transform: translateY(-2px); border-color: #bfdbfe; box-shadow: 0 12px 28px rgba(37,99,235,.13); }
.tc-inner { display: flex; align-items: flex-start; gap: 17px; padding: 24px 22px; }
.tool-chip {
    width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.05rem;
    box-shadow: inset 0 -2px 5px rgba(0,0,0,.13), 0 2px 6px rgba(15,23,42,.08);
    background: linear-gradient(135deg, #60a5fa, #2563eb);
}
.tool-chip.cat-pdf-convert { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.tool-chip.cat-pdf-edit { background: linear-gradient(135deg, #f87171, #dc2626); }
.tool-chip.cat-pdf-organize { background: linear-gradient(135deg, #c084fc, #8b5cf6); }
.tool-chip.cat-image-convert { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.tool-chip.cat-image-edit { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.tc-body { min-width: 0; padding-top: 2px; }
.tc-body .tool-title {
    font-size: 1.06rem; font-weight: 700; letter-spacing: -0.01em;
    color: var(--as-text); margin-bottom: 5px;
}
.tc-body .tool-description {
    font-size: 0.83rem; color: var(--as-muted); font-weight: 500; line-height: 1.5;
}

/* features — slim trust strip, not heavy cards */
.as-features { margin-top: 36px; }
.section-title {
    font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em;
    color: var(--as-text); margin-bottom: 12px;
}
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.feature-card {
    display: flex; align-items: flex-start; gap: 11px;
    background: #fff; border: 1px solid var(--as-border); border-radius: 12px;
    padding: 13px 15px; box-shadow: none;
}
.feature-icon {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    background: var(--as-accent-soft); color: var(--as-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; margin-bottom: 0;
}
.feature-card h3 { font-size: 0.83rem; font-weight: 700; color: var(--as-text); margin-bottom: 1px; }
.feature-card p { font-size: 0.73rem; color: var(--as-muted); line-height: 1.45; }

/* FAQ — compact */
.as-faq { margin-top: 36px; }
.faq-item {
    background: #fff; border: 1px solid var(--as-border); border-radius: 14px;
    margin-bottom: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04); overflow: hidden;
}
.faq-question {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 18px; cursor: pointer;
}
.faq-question h3 { font-size: 0.88rem; font-weight: 600; color: var(--as-text); }
.faq-toggle { color: var(--as-muted); font-size: 0.8rem; transition: transform .2s; }
.faq-answer { padding: 0 20px; }
.faq-item.active .faq-answer { padding-bottom: 16px; }
.faq-answer p { font-size: 0.875rem; color: var(--as-muted); line-height: 1.6; }
.as-faq-more { text-align: center; margin-top: 14px; }
.as-more-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px;
    background: #fff; color: var(--as-muted);
    border: 1px solid var(--as-border); border-radius: 9px;
    font-size: 0.85rem; font-weight: 600;
    transition: color .15s, border-color .15s;
}
.as-more-btn:hover { color: var(--as-accent); border-color: var(--as-accent); }

/* footer (legacy markup reused, styled fresh) */
body.as-home .footer { background: #fff; border-top: 1px solid var(--as-border); margin-top: 40px; }
body.as-home .footer .container { max-width: 1180px; margin: 0 auto; padding: 36px 32px 26px; }
body.as-home .footer-content {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 24px;
}
body.as-home .footer-section h4 { font-size: 0.92rem; font-weight: 800; color: var(--as-text); margin-bottom: 10px; }
body.as-home .footer-section p { font-size: 0.83rem; color: var(--as-muted); line-height: 1.5; }
body.as-home .footer-section li { margin-bottom: 7px; }
body.as-home .footer-section a { font-size: 0.83rem; color: var(--as-muted); }
body.as-home .footer-section a:hover { color: var(--as-accent); }
body.as-home .social-links { display: flex; gap: 9px; margin-top: 12px; }
body.as-home .social-links a {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--as-border);
    display: flex; align-items: center; justify-content: center;
    color: var(--as-muted); font-size: 0.85rem;
}
body.as-home .social-links a:hover { color: var(--as-accent); border-color: var(--as-accent); }
body.as-home .footer-bottom {
    border-top: 1px solid var(--as-border); padding-top: 16px;
    font-size: 0.78rem; color: #94a3b8;
}
body.as-home .footer-bottom p { margin-bottom: 3px; }

/* ==========================================================================
   TOOL PAGE reskin (legacy markup, new look)
   ========================================================================== */

body.app-shell .tool-container {
    max-width: 880px !important; margin: 0 auto !important; padding: 36px 24px 80px !important;
}
body.app-shell .tool-main {
    background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important;
}

/* tool hero — the topbar already shows the tool name, so the legacy in-page
   title block is hidden to avoid a duplicated heading */
body.tool-page .tool-title { display: none !important; }
body.tool-page .tool-title h1 {
    font-size: 1.9rem !important; font-weight: 800 !important; letter-spacing: -0.02em;
    color: var(--as-text) !important; margin: 12px 0 0 !important;
}
body.tool-page .tool-title .tool-icon { margin: 0 auto !important; }
body.tool-page .tool-title .tool-icon,
body.tool-page .tool-main > .tool-title > .tool-icon {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}
body.tool-page .tool-description {
    text-align: center; font-size: 1rem !important; color: var(--as-muted) !important;
    margin: 8px 0 26px !important;
}

/* upload area → big white card with dashed zone */
body.app-shell .upload-area {
    background: #fff !important; border: 2px dashed #a8c3f0 !important;
    border-radius: 18px !important; padding: 52px 24px !important;
    box-shadow: 0 1px 2px rgba(15,23,42,.04) !important;
    transition: background .2s, border-color .2s !important; cursor: pointer;
}
body.app-shell .upload-area:hover, body.app-shell .upload-area.drag-over, body.app-shell .upload-area.dragover {
    background: var(--as-accent-soft) !important; border-color: var(--as-accent) !important;
    transform: none !important;
}
body.app-shell .upload-icon i {
    font-size: 2rem !important; color: var(--as-accent) !important;
    background: var(--as-accent-soft); width: 72px; height: 72px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px;
}
body.app-shell .upload-text h3 { font-size: 1.1rem !important; font-weight: 700 !important; color: var(--as-text) !important; }
body.app-shell .upload-text p { color: var(--as-muted) !important; font-size: 0.875rem !important; }
body.app-shell .file-types {
    display: inline-block; margin-top: 10px !important; font-size: 0.78rem !important;
    color: #94a3b8 !important; background: #f1f5f9 !important;
    border-radius: 999px !important; padding: 5px 13px !important; border: none !important;
}

/* file preview / options / results → white cards */
body.app-shell .file-preview,
body.app-shell .options-panel,
body.app-shell .results-section,
body.app-shell .tips-section {
    background: #fff !important; border: 1px solid var(--as-border) !important;
    border-radius: 16px !important; box-shadow: 0 1px 2px rgba(15,23,42,.04) !important;
    padding: 20px !important; margin-top: 18px !important;
}
body.app-shell .options-header { background: none !important; padding: 0 0 6px !important; border: none !important; }
body.app-shell .options-header h3 { font-size: 1rem !important; font-weight: 700 !important; color: var(--as-text) !important; }
body.app-shell .options-header i { color: var(--as-accent) !important; }
body.app-shell .option-group label {
    font-size: 0.78rem !important; font-weight: 700 !important; color: var(--as-muted) !important;
}
body.app-shell .option-group select, body.app-shell .option-group input {
    border: 1.5px solid var(--as-border) !important; border-radius: 9px !important;
    padding: 10px 12px !important; font-size: 0.9rem !important; font-family: inherit !important;
    background: #fff !important; color: var(--as-text) !important; box-shadow: none !important;
}
body.app-shell .option-group select:focus, body.app-shell .option-group input:focus {
    border-color: var(--as-accent) !important; outline: none !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.13) !important;
}

/* buttons */
body.app-shell .btn {
    border-radius: 10px !important; font-weight: 600 !important; font-family: inherit !important;
    transition: transform .16s, box-shadow .16s, background .16s !important;
    box-shadow: none !important;
}
body.app-shell .btn-primary {
    background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
    border: none !important; color: #fff !important;
    box-shadow: 0 2px 8px rgba(37,99,235,.32), inset 0 1px 0 rgba(255,255,255,.22) !important;
}
body.app-shell .btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #4f8df7, #2563eb) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(37,99,235,.38) !important;
}
body.app-shell .btn-primary:disabled { background: #cbd5e1 !important; box-shadow: none !important; }
body.app-shell .btn-secondary {
    background: #fff !important; border: 1px solid var(--as-border) !important; color: var(--as-text) !important;
}
body.app-shell .btn-secondary:hover:not(:disabled) { background: #f8fafc !important; }
body.app-shell .btn-success {
    background: linear-gradient(180deg, #22c55e, #16a34a) !important; border: none !important; color: #fff !important;
    box-shadow: 0 2px 8px rgba(22,163,74,.3) !important;
}
body.app-shell .action-buttons { margin-top: 18px !important; display: flex; gap: 10px; justify-content: center; }

/* results */
body.app-shell .results-header h2 { color: var(--as-green) !important; font-size: 1.3rem !important; font-weight: 800 !important; }
body.app-shell .results-header p { color: var(--as-muted) !important; }

/* tips → 4-up mini cards */
body.app-shell .tips-section h3 { font-size: 1rem !important; font-weight: 800 !important; color: var(--as-text) !important; margin-bottom: 14px !important; }
body.app-shell .tips-list { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
body.app-shell .tip-item {
    background: #f8fafc !important; border: 1px solid var(--as-border) !important;
    border-radius: 12px !important; padding: 14px !important; box-shadow: none !important;
}
body.app-shell .tip-item i { color: var(--as-accent) !important; font-size: 0.95rem !important; }
body.app-shell .tip-item h4 { font-size: 0.875rem !important; font-weight: 700 !important; color: var(--as-text) !important; }
body.app-shell .tip-item p { font-size: 0.78rem !important; color: var(--as-muted) !important; line-height: 1.5 !important; }

/* progress bars if present */
body.app-shell .progress-bar, body.app-shell progress { border-radius: 999px !important; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
    body.app-shell .features-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 860px) {
    body.app-shell { padding-left: 64px; }
    .as-sidebar { width: 64px; padding: 14px 9px; align-items: center; }
    .as-item { justify-content: center; padding: 12px 0; }
    .as-item span { display: none; }
    .as-item.active::before { left: -9px; }
    .as-item-wrap { width: 100%; }
    .as-divider { width: 100%; }
    .as-flyout {
        position: fixed; left: 64px; top: 70px; bottom: auto;
        max-height: calc(100vh - 90px); min-width: min(240px, 70vw);
        border-left-width: 0;
    }
    .as-item-wrap:nth-last-of-type(-n+2) .as-flyout { top: 70px; bottom: auto; }
    .as-secure span { display: none; }
    .as-secure { justify-content: center; }
    .as-topbar { left: 64px; }
    .as-topbar .as-title { font-size: 0.95rem !important; }
    .as-logo { justify-content: center; margin-left: 0; }
}
@media (max-width: 640px) {
    body.app-shell .features-grid { grid-template-columns: 1fr !important; }
    body.app-shell .tips-list { grid-template-columns: 1fr !important; }
    .as-main { padding: 28px 16px 32px; }
    body.as-home .footer-content { grid-template-columns: 1fr 1fr; }
    body.as-home .footer .container { padding: 28px 16px 20px; }
}
@media (max-width: 480px) {
    body.as-home .footer-content { grid-template-columns: 1fr; }
}
