/*
 * webappplus.com public site — complements Tailwind utilities (template_html/webappplus.html).
 * Holds the template's custom styles plus rich-text, form-state and plugin theming.
 */
:root {
    --brand: #dc2626;
    --brand-hover: #b91c1c;
    --ink: #030712;
    --line: #e2e8f0;
    --muted: #475569;
}

/* Custom scrollbar (template) */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* Clean card (template) */
.glass-card-light { background: #ffffff; border: 1px solid var(--line); }
.glass-card-light:hover { border-color: var(--brand); }

/* Scroll reveal (template) — elements stay visible when JavaScript is unavailable */
.js .reveal { opacity: 0; transform: translateY(30px); transition: opacity .6s cubic-bezier(0.16, 1, 0.3, 1), transform .6s cubic-bezier(0.16, 1, 0.3, 1); }
.js .reveal.active { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto !important; }
}

.d-none { display: none !important; }
.d-block { display: block !important; }
.text-start { text-align: left; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Header shadow on scroll */
#navbar.is-scrolled { box-shadow: 0 8px 30px rgba(3, 7, 18, .06); }
.nav-link-active { color: var(--brand) !important; }

/* Navbar dropdowns (main.js: [data-dropdown]) */
.dropdown-menu { z-index: 60; opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .18s ease, transform .18s ease, visibility .18s; }
.dropdown-menu.left-1\/2 { transform: translate(-50%, 6px); }
[data-dropdown].is-open > .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
[data-dropdown].is-open > .dropdown-menu.left-1\/2 { transform: translate(-50%, 0); }
.dropdown-menu-inline { display: none; opacity: 1; visibility: visible; transform: none; }
[data-dropdown].is-open > .dropdown-menu-inline { display: block; }
.dropdown-chevron { transition: transform .2s ease; }
[data-dropdown].is-open .dropdown-chevron { transform: rotate(180deg); }

/* Back to top button */
.go-top { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40; width: 3rem; height: 3rem; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; box-shadow: 0 10px 25px rgba(220, 38, 38, .3); opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .25s ease, transform .25s ease, visibility .25s, background-color .2s; }
.go-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.go-top:hover { background: #b91c1c; }
.go-top:focus-visible { outline: 3px solid rgba(220, 38, 38, .4); outline-offset: 3px; }

/* Form states (form-validation.js) */
.is-invalid { border-color: #ef4444 !important; }
.invalid-feedback { margin-top: .35rem; font-size: .78rem; color: #f87171; }
.form-light .invalid-feedback { color: #b91c1c; }
.spinner-border { display: inline-block; width: 1rem; height: 1rem; border: .15em solid currentColor; border-right-color: transparent; border-radius: 50%; animation: site-spin .7s linear infinite; vertical-align: -.125em; }
.spinner-border-sm { width: .85rem; height: .85rem; }
@keyframes site-spin { to { transform: rotate(360deg); } }

/* Rich content from the CMS (articles, page contents, FAQ answers) */
.rich-content { color: #334155; line-height: 1.85; font-size: 1rem; overflow-wrap: anywhere; }
.rich-content > * + * { margin-top: 1rem; }
.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4 { color: var(--ink); font-weight: 700; line-height: 1.35; margin-top: 2rem; }
.rich-content h1 { font-size: 1.875rem; }
.rich-content h2 { font-size: 1.5rem; }
.rich-content h3 { font-size: 1.25rem; }
.rich-content h4 { font-size: 1.1rem; }
.rich-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.rich-content a:hover { color: var(--brand-hover); }
.rich-content strong, .rich-content b { color: var(--ink); font-weight: 600; }
.rich-content ul { list-style: disc; padding-left: 1.5rem; }
.rich-content ol { list-style: decimal; padding-left: 1.5rem; }
.rich-content li + li { margin-top: .35rem; }
.rich-content li::marker { color: var(--brand); }
.rich-content blockquote { border-left: 4px solid var(--brand); padding: .75rem 1.25rem; background: #fef2f2; border-radius: 0 .75rem .75rem 0; color: #1e293b; }
.rich-content img, .rich-content video, .rich-content iframe { max-width: 100%; height: auto; border-radius: 1rem; }
.rich-content iframe { aspect-ratio: 16 / 9; width: 100%; height: auto; }
.rich-content table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.rich-content th, .rich-content td { border: 1px solid var(--line); padding: .6rem .8rem; text-align: left; }
.rich-content th { background: #f8fafc; color: var(--ink); }
.rich-content pre, .rich-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
.rich-content pre { background: var(--ink); color: #e2e8f0; padding: 1rem 1.25rem; border-radius: .75rem; overflow-x: auto; }
.rich-content hr { border-color: var(--line); margin: 2rem 0; }

/* FAQ accordion (ui.js collapse) */
.collapse:not(.show) { display: none; }
.collapse.show { visibility: visible; }

/* Lazy image skeleton: shimmer until ui.js marks the image .is-loaded (only when JS runs) */
.js img[loading="lazy"]:not(.is-loaded) { color: transparent; aspect-ratio: 16 / 9; background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%) 0 0 / 200% 100%; animation: img-skeleton 1.2s ease-in-out infinite; }
.js img[loading="lazy"].is-loaded { animation: img-fade-in .35s ease; }
@keyframes img-skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes img-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .js img[loading="lazy"] { animation: none !important; } } /* override Tailwind's `.collapse { visibility: collapse }` utility */
.faq-toggle .faq-icon { transition: transform .2s ease; }
.faq-toggle:not(.collapsed) .faq-icon { transform: rotate(45deg); }
.faq-toggle:not(.collapsed) { color: var(--brand); }

/* Select2 — light and dark variants */
.select2-container { font-size: .9rem; }
.select2-container--default .select2-selection--single { height: auto; min-height: 3rem; display: flex; align-items: center; border: 1px solid var(--line); border-radius: .75rem; background: #fff; padding: 0 .5rem; }
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--ink); line-height: 2.8rem; padding-left: .25rem; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 100%; right: .6rem; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--brand); }
.select2-dropdown { border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; box-shadow: 0 18px 40px rgba(15, 23, 42, .12); }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--brand); }
.select2-dark + .select2-container .select2-selection--single,
.select2-dark + .select2-container--default .select2-selection--single { background: var(--ink); border-color: #334155; }
.select2-dark + .select2-container .select2-selection__rendered { color: #fff !important; }
.select2-dark + .select2-container .select2-selection__arrow b { border-color: #94a3b8 transparent transparent transparent !important; }
.select2-dark + .select2-container.select2-container--focus .select2-selection--single { border-color: var(--brand); }
.frontend-select2-dropdown.select2-dropdown--dark { background: #0f172a; border-color: #334155; color: #e2e8f0; }

/* Flatpickr */
.flatpickr-calendar { border-radius: .9rem !important; font-family: inherit; box-shadow: 0 18px 40px rgba(15, 23, 42, .15) !important; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--brand) !important; border-color: var(--brand) !important; }

/* SweetAlert2 */
.swal2-popup { border-radius: 1.25rem !important; font-family: inherit !important; }
.swal2-styled.swal2-confirm { border-radius: .75rem !important; background-color: var(--brand) !important; }

/* Fancybox caption */
.fancybox__caption { font-family: inherit; }
.fancybox__caption strong { display: block; font-size: 1.05rem; margin-bottom: .25rem; }

/* Line clamp fallback for article cards */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- Social share buttons (partials/share-buttons.php) */
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--share-color, #0f172a);
    font-size: 1rem;
    transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.share-btn:hover,
.share-btn:focus-visible,
.share-btn.is-done {
    background: var(--share-color, #0f172a);
    border-color: var(--share-color, #0f172a);
    color: #fff;
    transform: translateY(-2px);
}
.share-btn:focus-visible { outline: 2px solid var(--share-color, #0f172a); outline-offset: 2px; }
.share-btn[hidden] { display: none; }
.share-bar--dark .share-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .15); color: #fff; }
