/* ==========================================================================
   ConvertMyDoc.in stylesheet
   Palette: ink navy #1B2A4A / paper #FAFBFC / saffron #E8850C /
            slate #3D4A5C / mist #E4E9F0
   Type:    Sora (display), system stack (body)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700&display=swap');

:root {
    --ink: #1B2A4A;
    --paper: #FAFBFC;
    --saffron: #E8850C;
    --saffron-dark: #C46E05;
    --slate: #3D4A5C;
    --mist: #E4E9F0;
    --white: #FFFFFF;
    --muted: #6B7789;
    --heading: var(--ink);
    --card-bg: var(--white);
    --tint: #FFF9F1;
    --tint-strong: #FDEBD2;
    /* Muted text specifically for content sitting on the constant-navy
       sections (header/hero/footer). Deliberately NOT theme-swapped -
       same reasoning as --ink/--white staying constant: that navy
       background never changes between themes, so text drawn on it
       can't swap to a dark tone without becoming unreadable. */
    --navy-muted: #E4E9F0;
    --success-bg: #E6F4EA;
    --success-text: #1E6B34;
    --error-bg: #FBEAEA;
    --error-text: #9B2020;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(27, 42, 74, 0.08), 0 4px 14px rgba(27, 42, 74, 0.06);
    --display: 'Sora', system-ui, sans-serif;
    --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    color-scheme: light;
}

/* Dark theme - toggled via [data-theme="dark"] on <html> (see theme.js).
   --ink and --white deliberately stay OUT of this block: they're used
   as the constant brand-navy background (header/footer/hero/buttons)
   and the text that sits on it, which should stay put in both themes
   rather than invert. --heading and --card-bg are the theme-aware ones -
   everything else here follows the same "same variable name, different
   value" pattern so components need no other changes. */
[data-theme="dark"] {
    --paper: #12192B;
    --saffron: #F5A623;
    --saffron-dark: #FFC266;
    --slate: #C7D0DC;
    --mist: #2A3550;
    --muted: #93A0B5;
    --heading: #F0F4FA;
    --card-bg: #1B2440;
    --tint: #26202A;
    --tint-strong: #332A22;
    --success-bg: #17301F;
    --success-text: #6FCF8C;
    --error-bg: #331A1A;
    --error-text: #F28B82;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);

    color-scheme: dark;
}

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

body {
    font-family: var(--body);
    background: var(--paper);
    color: var(--slate);
    line-height: 1.6;
    font-size: 16px;
}

h1, h2, h3 { font-family: var(--display); color: var(--heading); line-height: 1.2; }

a { color: var(--saffron-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--saffron);
    outline-offset: 2px;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* --- Header ------------------------------------------------------------ */
.site-header {
    background: var(--ink);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.logo {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--white);
}
.logo span { color: var(--saffron); }
.logo:hover { text-decoration: none; }

.header-search {
    flex: 1;
    display: flex;
    min-width: 200px;
    max-width: 420px;
}
.header-search input {
    flex: 1;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 8px 14px;
    font-size: 0.95rem;
}
.header-search button {
    border: none;
    background: var(--saffron);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 1rem;
}

.main-nav { display: flex; gap: 18px; }
.main-nav a { color: var(--navy-muted); font-size: 0.95rem; }
.main-nav a:hover { color: var(--white); }

.theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.16); }

.install-app {
    background: var(--saffron);
    color: var(--white);
    border: 0;
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.install-app:hover { background: var(--saffron-dark); }
.install-app i { font-style: normal; }

/* --- Hero --------------------------------------------------------------- */
.hero {
    background:
        radial-gradient(1200px 400px at 85% -50%, rgba(232, 133, 12, 0.18), transparent),
        var(--ink);
    color: var(--navy-muted);
    padding: 72px 0 80px;
    text-align: center;
}
.hero h1 {
    color: var(--white);
    font-size: clamp(2rem, 5vw, 3.2rem);
    margin-bottom: 12px;
}
.hero p { font-size: 1.15rem; margin-bottom: 32px; }

.hero-search {
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
}
.hero-search input {
    flex: 1;
    border: none;
    padding: 16px 20px;
    font-size: 1.05rem;
}
.hero-search button {
    border: none;
    background: var(--saffron);
    color: var(--ink);
    font-family: var(--display);
    font-weight: 600;
    padding: 0 28px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}
.hero-search button:hover { background: #F79A28; }

.hero-counter {
    margin-top: 20px;
    font-size: 0.92rem;
    color: var(--navy-muted);
}

/* --- Sections ----------------------------------------------------------- */
section.container { padding: 48px 20px; }
.page-header { padding-bottom: 8px; }
.page-header h1 { font-size: 2rem; margin-bottom: 8px; }

.categories h2, .why h2, .search-results h2, .tool-section h2, .related-tools h2 {
    margin-bottom: 24px;
    font-size: 1.5rem;
}
.tool-section h2 a { color: var(--heading); }

/* --- Category grid ------------------------------------------------------ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}
.category-card {
    background: var(--card-bg);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    padding: 22px;
    color: var(--slate);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    text-decoration: none;
}
.category-icon { font-size: 1.8rem; }
.category-card strong { color: var(--heading); font-size: 1.1rem; }
.category-card > span:not(.category-icon) {
    color: var(--saffron-dark);
    font-size: 0.85rem;
    font-weight: 600;
}
.category-card p { font-size: 0.9rem; }

/* --- Tool grid (icon-led cards) -------------------------------------------
   Each card leads with a from→to format-icon badge so the grid stays
   scannable even for a 40+ tool category, while keeping the familiar
   card layout. --------------------------------------------------------- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}
.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--slate);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.tool-card-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 1.4rem;
    background: var(--tint);
    border-radius: 8px;
    padding: 8px 10px;
    line-height: 1;
}
.format-arrow {
    font-size: 0.7em;
    color: var(--saffron-dark);
    margin: 0 1px;
}

.tool-card strong {
    color: var(--heading);
    font-size: 0.96rem;
    line-height: 1.35;
}
.tool-card-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Multiple tool-grids on one page (grouped by category on /tools) get a
   bit of extra breathing room between sections. */
.tool-section + .tool-section { margin-top: 8px; }

/* --- Why section --------------------------------------------------------- */
.why-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}
.why-grid > div {
    background: var(--card-bg);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    padding: 20px;
}
.why-grid strong { color: var(--heading); display: block; margin-bottom: 6px; font-family: var(--display); }
.why-grid p { font-size: 0.9rem; }

/* --- Tool page ------------------------------------------------------------ */
.tool-page { max-width: 760px; }
.breadcrumb { font-size: 0.88rem; margin-bottom: 18px; color: var(--slate); }
.tool-page h1 { font-size: 1.8rem; margin-bottom: 8px; }
.tool-description { margin-bottom: 24px; }

.convert-form {
    background: var(--card-bg);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.file-drop {
    border: 2px dashed var(--saffron);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    background: var(--tint);
    transition: background 0.15s, border-color 0.15s;
}
.file-drop.dragover { background: var(--tint-strong); border-color: var(--saffron-dark); }
.file-drop label {
    display: block;
    font-weight: 600;
    color: var(--heading);
    margin-bottom: 10px;
}
.file-drop input[type="file"] { font-size: 0.95rem; max-width: 100%; }

.text-input-drop {
    text-align: left;
    background: var(--card-bg);
}
.text-input-drop textarea {
    width: 100%;
    resize: vertical;
    font-family: var(--body);
}

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row label { flex: 1; min-width: 140px; }

.convert-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--heading);
}
.convert-form input[type="text"],
.convert-form input[type="number"],
.convert-form input[type="password"],
.convert-form input[type="email"],
.convert-form select,
.convert-form textarea,
.contact-form input,
.contact-form textarea {
    border: 1px solid var(--mist);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: var(--body);
    font-weight: 400;
}

.btn-primary {
    display: inline-block;
    background: var(--saffron);
    color: var(--ink);
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    border-radius: var(--radius);
    padding: 14px 26px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.btn-primary:hover { background: #F79A28; text-decoration: none; }
.btn-primary[disabled] { opacity: 0.6; cursor: wait; }

.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-progress-track {
    height: 8px;
    background: var(--mist);
    border-radius: 999px;
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--saffron);
    border-radius: 999px;
    transition: width 0.2s ease-out;
}
.upload-progress-label {
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
}

.privacy-note { font-size: 0.82rem; color: var(--muted); text-align: center; }

.advanced-options {
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    background: var(--tint);
}
.advanced-options summary {
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--heading);
    list-style: none;
}
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary::before { content: '▸ '; color: var(--saffron); }
.advanced-options[open] summary::before { content: '▾ '; }
.advanced-options-body {
    padding: 4px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.advanced-options-body label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--heading);
}
.advanced-options-body .privacy-note { text-align: left; margin: 0; }

/* --- Rating widget ----------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rating-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px 16px;
    background: var(--tint);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.rating-stars { color: var(--saffron); font-size: 1.1rem; letter-spacing: 1px; }
.rating-summary { font-size: 0.88rem; color: var(--slate); }

.rating-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}
.star-input {
    display: flex;
    flex-direction: row-reverse;
    border: none;
    padding: 0;
    margin: 0;
}
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label {
    cursor: pointer;
    color: #C9D2DD;
    font-size: 1.3rem;
    padding: 0 1px;
    transition: color 0.1s;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label {
    color: var(--saffron);
}
.rating-submit {
    background: var(--ink);
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}
.rating-submit:hover { background: #263a5f; }

/* --- How it works ------------------------------------------------------- */
.how-to-section {
    margin-top: 56px;
    padding-top: 8px;
}
.how-to-section h2 {
    font-size: 1.4rem;
    text-align: center;
}
.how-to-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 4px;
    margin-bottom: 28px;
}
.how-to-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}
.how-to-step {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.how-to-step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--white);
    font-family: var(--display);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.how-to-step strong { color: var(--heading); font-size: 0.98rem; }
.how-to-step p { font-size: 0.85rem; color: var(--muted); max-width: 240px; }

/* --- Features grid -------------------------------------------------------- */
.features-section {
    margin-top: 48px;
    background: var(--mist);
    border-radius: var(--radius);
    padding: 32px 24px;
}
.features-section h2 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 24px;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px 28px;
}
.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.feature-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.feature-item strong { color: var(--heading); font-size: 0.92rem; display: block; margin-bottom: 2px; }
.feature-item p { font-size: 0.84rem; color: var(--muted); }

.related-tools { margin-top: 48px; }

/* --- Ad slots --------------------------------------------------------------- */
.ad-slot-wrap { padding: 0 20px; }
.ad-slot {
    margin: 32px 0;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    text-align: center;
    overflow: hidden;
}
.ad-slot-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 8px;
}

/* --- Static pages ---------------------------------------------------------- */
.static-page { max-width: 720px; }
.static-page h1 { font-size: 1.9rem; margin-bottom: 16px; }
.static-page h2 { font-size: 1.25rem; margin: 24px 0 8px; }
.static-page p { margin-bottom: 12px; }

/* --- Blog --------------------------------------------------------------------- */
.blog-list { display: flex; flex-direction: column; gap: 4px; max-width: 760px; }
.blog-list-item {
    display: block;
    padding: 20px 0;
    border-bottom: 1px solid var(--mist);
    color: var(--slate);
}
.blog-list-item:hover { text-decoration: none; }
.blog-list-item:hover h2 { text-decoration: underline; }
.blog-list-item h2 { font-size: 1.25rem; margin-bottom: 6px; }
.blog-list-item p { font-size: 0.92rem; margin-bottom: 8px; }
.blog-list-date { font-size: 0.8rem; color: var(--muted); }

.blog-post-date { color: var(--muted); font-size: 0.88rem; margin-bottom: 24px; }
.blog-post-content { max-width: 720px; line-height: 1.75; }
.blog-post-content h2 { font-size: 1.4rem; margin: 32px 0 12px; }
.blog-post-content h3 { font-size: 1.15rem; margin: 24px 0 10px; }
.blog-post-content p { margin-bottom: 16px; }
.blog-post-content ul, .blog-post-content ol { margin: 0 0 16px 24px; }
.blog-post-content li { margin-bottom: 6px; }
.blog-post-content blockquote {
    border-left: 3px solid var(--saffron);
    padding-left: 16px;
    margin: 0 0 16px;
    color: var(--muted);
}
.blog-post-content code {
    background: var(--mist);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}
.blog-post-content pre {
    background: var(--ink);
    color: var(--white);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}
.blog-post-content pre code { background: none; padding: 0; color: inherit; }
.blog-post-content img { max-width: 100%; border-radius: var(--radius); margin-bottom: 16px; }
.blog-post-content a { text-decoration: underline; }

.contact-form { display: flex; flex-direction: column; gap: 16px; max-width: 480px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--heading); }

.api-docs-code {
    background: var(--ink);
    color: var(--white);
    padding: 14px 18px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 4rem; color: var(--saffron); }

/* --- Alerts ------------------------------------------------------------------ */
.alert { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; font-size: 0.95rem; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }

/* --- Footer -------------------------------------------------------------------- */
.site-footer {
    background: var(--ink);
    color: var(--navy-muted);
    margin-top: 64px;
    padding: 40px 0 0;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    padding-bottom: 28px;
}
.footer-brand { max-width: 380px; }
.footer-brand strong { font-family: var(--display); color: var(--white); font-size: 1.1rem; }
.footer-brand p { font-size: 0.88rem; margin-top: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--navy-muted); font-size: 0.92rem; }
.footer-links a:hover { color: var(--white); }
.footer-bottom {
    border-top: 1px solid rgba(228, 233, 240, 0.15);
    padding: 16px 20px;
    font-size: 0.82rem;
    text-align: center;
}

/* --- Responsive + motion --------------------------------------------------------- */
@media (max-width: 640px) {
    .header-inner { gap: 12px; }
    .header-search { order: 3; max-width: none; width: 100%; }
    .hero { padding: 48px 0 56px; }
    .hero-search { flex-direction: column; }
    .hero-search button { padding: 14px; }
    .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* --- Dark theme: the handful of things the variable system alone can't
   cover, because they're a fixed literal rather than a themed variable. */
[data-theme="dark"] .star-input label { color: #4A5570; }
