/* ============================================================
   SolveItLocal — Global UI Styles
   Unified styling for the global navigation, footer, and mobile
   accessibility fixes.
   ============================================================ */

/* ── Mobile Accessibility (Anti-Zoom) ───────────────────────── */
/* iOS Safari auto-zooms if form inputs are less than 16px. */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
    font-size: 16px !important;
}

/* ── Mobile Accessibility (Tap Targets) ─────────────────────── */
/* Ensure minimum 44x44px touch targets on mobile viewports */
@media (max-width: 768px) {
    input, select, button, label {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ── Global Navigation Header ───────────────────────────────── */
.sil-global-nav {
    width: 100%;
    background-color: #04070a;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sil-global-nav__container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sil-global-nav__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #f1f5f9;
    transition: opacity 0.2s ease;
}

.sil-global-nav__brand:hover {
    opacity: 0.8;
}

.sil-global-nav__logo {
    width: 20px;
    height: 20px;
    color: #38bdf8;
}

.sil-global-nav__title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.sil-global-nav__search-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sil-global-nav__search-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.4);
}

/* ── Nav Actions Container ─────────────────────────────────── */
.sil-global-nav__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Theme Toggle Button ───────────────────────────────────── */
.sil-global-nav__theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.sil-global-nav__theme-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.4);
    transform: scale(1.05);
}

/* Show sun in dark mode, moon in light mode */
[data-theme="dark"] .sil-theme-icon--sun,
:root:not([data-theme]) .sil-theme-icon--sun { display: block; }
[data-theme="dark"] .sil-theme-icon--moon,
:root:not([data-theme]) .sil-theme-icon--moon { display: none; }

[data-theme="light"] .sil-theme-icon--sun { display: none; }
[data-theme="light"] .sil-theme-icon--moon { display: block; }

/* ── Light Mode Overrides (Global UI) ──────────────────────── */
[data-theme="light"] .sil-global-nav {
    background-color: #f8fafc;
    border-bottom-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .sil-global-nav__brand {
    color: #0f172a;
}

[data-theme="light"] .sil-global-nav__logo {
    color: #2563eb;
}

[data-theme="light"] .sil-global-nav__search-btn {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .sil-global-nav__search-btn:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.4);
}

[data-theme="light"] .sil-global-nav__theme-btn {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
    color: #2563eb;
}

[data-theme="light"] .sil-global-nav__theme-btn:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.4);
}

[data-theme="light"] .sil-global-footer {
    background-color: #f1f5f9;
    border-top-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .sil-global-footer__container p {
    color: #475569;
}

[data-theme="light"] .sil-global-footer__links a {
    color: #475569;
}

[data-theme="light"] .sil-global-footer__links a:hover {
    color: #2563eb;
}

[data-theme="light"] .sil-feedback {
    background-color: rgba(241, 245, 249, 0.8);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .sil-feedback h3 {
    color: #0f172a;
}

[data-theme="light"] .sil-feedback__btn {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.15);
    color: #0f172a;
}

[data-theme="light"] .sil-feedback__form textarea {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.15);
    color: #0f172a;
}

[data-theme="light"] .sil-related__card {
    background: rgba(241, 245, 249, 0.8);
    border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .sil-related__card:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: #ffffff;
}

[data-theme="light"] .sil-related__card-name {
    color: #0f172a;
}

[data-theme="light"] .sil-related__card:hover .sil-related__card-name {
    color: #2563eb;
}

[data-theme="light"] .sil-recommend {
    background: linear-gradient(145deg, rgba(241, 245, 249, 0.8), rgba(226, 232, 240, 0.5));
    border-color: rgba(245, 158, 11, 0.2);
}

[data-theme="light"] .sil-recommend__card {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .sil-recommend__card-name {
    color: #0f172a;
}

/* ── Global Footer ──────────────────────────────────────────── */
.sil-global-footer {
    width: 100%;
    background-color: #04070a;
    border-top: 1px solid rgba(56, 189, 248, 0.1);
    padding: 2rem 1.5rem;
    margin-top: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sil-global-footer__container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.sil-global-footer__container p {
    color: #64748b;
    font-size: 0.8rem;
    margin: 0;
}

.sil-global-footer__links {
    display: flex;
    gap: 1.5rem;
}

.sil-global-footer__links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.sil-global-footer__links a:hover {
    color: #38bdf8;
}

/* Adjust main layout to fill remaining height */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Make sure the existing app main content expands */
.app-main, main {
    flex: 1 0 auto;
}

/* ── Feedback Widget ───────────────────────────────────────── */
.sil-feedback {
    max-width: 600px;
    margin: 3rem auto 2rem;
    padding: 1.5rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 12px;
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sil-feedback h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sil-feedback__buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.sil-feedback__btn {
    padding: 0.6rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background-color: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
    transition: all 0.2s ease;
    font-family: inherit;
}

.sil-feedback__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sil-feedback__btn:hover:not(:disabled) {
    border-color: #38bdf8;
    color: #38bdf8;
}

.sil-feedback__btn-icon {
    margin-right: 0.25rem;
}

.sil-feedback__btn--yes:hover {
    border-color: #10b981 !important;
    color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.1);
}

.sil-feedback__btn--no:hover {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.1);
}

/* Form state */
.sil-feedback__form {
    text-align: left;
}

.sil-feedback__form h3 {
    text-align: center;
}

.sil-feedback__form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    background-color: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.sil-feedback__form textarea:focus {
    outline: none;
    border-color: #38bdf8;
}

.sil-feedback__form-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.sil-feedback__btn--submit {
    background-color: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
}

.sil-feedback__btn--submit:hover:not(:disabled) {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
    color: #0f172a !important;
}

.sil-feedback__btn--cancel {
    background-color: transparent;
}

/* Status messages */
.sil-feedback__status p {
    margin: 0;
    font-size: 0.95rem;
    color: #94a3b8;
}

.sil-feedback__status--success p {
    color: #10b981;
    font-weight: 500;
}

.sil-feedback__status--error p {
    color: #ef4444;
    margin-bottom: 0.75rem;
}

/* ── Related Tools Cross-Links ──────────────────────────────── */
.sil-related {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sil-related__title {
    font-size: 1rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem;
    text-align: center;
}

.sil-related__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.sil-related__card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sil-related__card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(15, 23, 42, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.sil-related__card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.sil-related__card-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sil-related__card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sil-related__card-tagline {
    font-size: 0.72rem;
    color: #64748b;
}

.sil-related__card:hover .sil-related__card-name {
    color: #38bdf8;
}

/* ── Tools We Recommend (Product Cards) ─────────────────────── */
.sil-recommend {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.5));
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sil-recommend__title {
    font-size: 1rem;
    font-weight: 700;
    color: #f59e0b;
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sil-recommend__subtitle {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0 0 1.25rem;
}

.sil-recommend__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.sil-recommend__card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sil-recommend__card:hover {
    border-color: rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.sil-recommend__card-icon {
    font-size: 1.75rem;
}

.sil-recommend__card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sil-recommend__card-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
}

.sil-recommend__card-cta {
    font-size: 0.75rem;
    font-weight: 600;
    color: #f59e0b;
    margin-top: auto;
}

.sil-recommend__card:hover .sil-recommend__card-cta {
    text-decoration: underline;
}

.sil-recommend__disclosure {
    font-size: 0.65rem;
    color: #475569;
    text-align: center;
    margin-top: 1rem;
}

/* ── AEO Answer Block (Direct Answer for AI Extraction) ─────── */
.answer-block {
    font-size: 0.95rem;
    line-height: 1.75;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0 1.5rem;
    border-left: 3px solid var(--accent, #38bdf8);
    background: var(--bg-card, rgba(15, 23, 42, 0.3));
    border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
    opacity: 0.9;
}

/* ── Tool Disclaimer ─────────────────────────────────────────
   Legal / safety disclosures. These MUST live inside <main>:
   global-ui.js removes every non-global <footer> before it
   injects the shared footer, so anything placed in a local
   <footer> is destroyed before the user ever sees it.
   ─────────────────────────────────────────────────────────── */
.sil-tool-disclaimer {
    display: block;
    margin: 2rem 0 0;
    padding: 0.9rem 1.15rem;
    border: 1px solid var(--border, rgba(148, 163, 184, 0.18));
    border-radius: var(--radius, 8px);
    background: var(--bg-card, rgba(15, 23, 42, 0.3));
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sil-tool-disclaimer p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-muted, #94a3b8);
}

.sil-tool-disclaimer p + p {
    margin-top: 0.6rem;
}

.sil-tool-disclaimer strong {
    color: var(--text, #cbd5e1);
}

[data-theme="light"] .sil-tool-disclaimer {
    background: rgba(241, 245, 249, 0.8);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .sil-tool-disclaimer p {
    color: #475569;
}

[data-theme="light"] .sil-tool-disclaimer strong {
    color: #0f172a;
}

/* ── FAQ Section (Injected by Phase 2 SEO Upgrade) ──────────── */
.faq-section details {
    border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.15));
    border-radius: var(--radius, 12px);
    padding: 0;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.faq-section details:hover {
    border-color: var(--border-hover, rgba(148, 163, 184, 0.3));
}

.faq-section details[open] {
    border-color: var(--border-hover, rgba(148, 163, 184, 0.3));
}

.faq-section details summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
    -webkit-user-select: none;
}

.faq-section details summary::-webkit-details-marker {
    display: none;
}

.faq-section details summary::before {
    content: '+';
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50%;
    background: var(--bg-card-hover, rgba(148, 163, 184, 0.08));
    transition: transform 0.2s ease, background 0.2s ease;
}

.faq-section details[open] summary::before {
    content: '−';
    transform: rotate(0deg);
}

.faq-section details summary:hover {
    background: var(--bg-card-hover, rgba(148, 163, 184, 0.04));
}

.faq-section details p {
    padding: 0 1.25rem 1.25rem 3.5rem;
    line-height: 1.7;
    font-size: 0.9rem;
    opacity: 0.9;
}

@media (max-width: 600px) {
    .faq-section details summary {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    .faq-section details p {
        padding: 0 1rem 1rem 2.75rem;
        font-size: 0.85rem;
    }
}
