/*
 * Gizmo Watch Help Center — style.css
 * Verizon-branded responsive design, mobile-first
 *
 * Colors:
 *   Primary text:       #000000
 *   Background:         #FFFFFF
 *   Accent (Verizon):   #EE0000 (used sparingly — links, hover)
 *   Secondary text:     #666666
 *   Borders:            #E0E0E0
 *   Search bg:          #F5F5F5
 *   Pill active bg:     #000000
 *   Expanded answer bg: #FAFAFA
 *
 * Breakpoints:
 *   Base:    320px+ (phone / GizmoHub webview)
 *   Tablet:  768px+
 *   Desktop: 1024px+
 */

/* ═══════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 76px; /* Sticky .search-container offset (~70px + 6px buffer) */
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    color: #000000;
    background-color: #FFFFFF;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Safe area for notched phones */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    overscroll-behavior: none;  /* DA-1: prevent pull-to-refresh in WebView */
}

a {
    color: #CC0000;
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

/* DA-2: Suppress default tap highlight flash on Android WebView */
button,
a,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════ */

.header {
    background-color: #000000;
    color: #FFFFFF;
    padding: 20px 16px;
    padding-top: calc(20px + env(safe-area-inset-top));
    text-align: center;
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.header-subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    color: #CCCCCC;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   Search
   ═══════════════════════════════════════════════ */

.search-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #FFFFFF;
    padding: 12px 16px;
    border-bottom: 1px solid #E0E0E0;
}

.search-wrapper {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #666666;
    pointer-events: none;
}

.search-input {
    width: 100%;
    /* 16px minimum prevents iOS zoom on focus */
    font-size: 16px;
    padding: 12px 40px 12px 40px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    background-color: #F5F5F5;
    color: #000000;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.search-input:focus {
    border-color: #000000;
    background-color: #FFFFFF;
}

.search-input:focus-visible {
    box-shadow: 0 0 0 2px #EE0000;
}

.search-input::placeholder {
    color: #999999;
}

/* Remove browser default search clear button */
.search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;   /* WCAG 2.5.5 AAA touch target (SVG stays 18px, centered) */
    min-height: 44px;  /* WCAG 2.5.5 AAA touch target */
}

.search-clear:hover {
    color: #000000;
}

/* ═══════════════════════════════════════════════
   Category Pills
   ═══════════════════════════════════════════════ */

.category-nav {
    background-color: #FFFFFF;
    border-bottom: 1px solid #E0E0E0;
    padding: 10px 0;
}

.category-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px;
    max-width: 832px; /* 800 + 32px padding */
    margin: 0 auto;
    /* Smooth momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;  /* Snap pills to clean alignment, not mandatory */
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.category-pill {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 6px 14px;
    border: 1px solid #E0E0E0;
    border-radius: 20px;
    background-color: #FFFFFF;
    color: #666666;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    /* Min tap target — WCAG 2.5.5 AAA */
    min-height: 44px;
    display: flex;
    align-items: center;
    scroll-snap-align: start;
}

.category-pill:hover {
    border-color: #000000;
    color: #000000;
}

.category-pill.active {
    background-color: #000000;
    border-color: #000000;
    color: #FFFFFF;
}

.category-pill:focus-visible {
    outline: 2px solid #EE0000;
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════
   Email Support CTA
   ═══════════════════════════════════════════════ */

.support-cta {
    padding: 12px 16px 0;
    max-width: 832px;  /* 800 + 32px padding — matches .category-pills */
    margin: 0 auto;
}

.support-cta-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    background: #FFFFFF;
}

.support-cta-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F5F5F5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666666;
}

.support-cta-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 2px;
}

.support-cta-text {
    font-size: 0.8125rem;
    color: #666666;
    line-height: 1.5;
}

.support-cta-btn {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #FFFFFF;
    background: #000000;
    padding: 6px 16px;
    border-radius: 6px;
    text-decoration: none;
    margin-left: 6px;
    white-space: nowrap;
    transition: background 0.15s;
    /* Align button baseline with text */
    vertical-align: middle;
}

.support-cta-btn:hover {
    background: #333333;
    text-decoration: none;
}

.support-cta-btn:focus-visible {
    outline: 2px solid #EE0000;
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════
   FAQ Container
   ═══════════════════════════════════════════════ */

.faq-container {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 24px;
}

/* ═══════════════════════════════════════════════
   FAQ Item — Accordion
   ═══════════════════════════════════════════════ */

.faq-item {
    border-bottom: 1px solid #E0E0E0;
}

.faq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #000000;
    /* Min tap target 44px */
    min-height: 44px;
    gap: 12px;
    transition: color 0.15s;
}

.faq-header:hover {
    color: #CC0000;
}

.faq-header:focus-visible {
    outline: 2px solid #EE0000;
    outline-offset: -2px;
    border-radius: 4px;
}

.faq-title {
    flex: 1;
    line-height: 1.4;
}

.faq-chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: #666666;
    transition: transform 0.25s ease;
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════
   FAQ Body — Expand/Collapse Animation
   ═══════════════════════════════════════════════ */

.faq-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.faq-item.open .faq-body {
    /*
     * max-height must be larger than any possible content.
     * Using a generous value — CSS transition animates FROM 0 TO this,
     * and the easing curve makes it look smooth even if content is shorter.
     */
    max-height: 2000px;
    padding: 0 0 16px 0;
}

.faq-answer {
    background-color: #FAFAFA;
    border-radius: 8px;
    padding: 16px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #333333;
    word-break: break-word;
}

.faq-answer a {
    color: #CC0000;
    word-break: break-all;
}

.faq-answer strong {
    color: #000000;
}

.faq-answer ul,
.faq-answer ol {
    margin: 8px 0;
    padding-left: 24px;
}

.faq-answer ul {
    list-style-type: disc;
}

.faq-answer ol {
    list-style-type: decimal;
}

.faq-answer li {
    margin-bottom: 4px;
    line-height: 1.6;
    color: #333333;
}

/* ═══════════════════════════════════════════════
   Related Topics
   ═══════════════════════════════════════════════ */

.faq-related {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #E0E0E0;
}

.faq-related-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #666666;
}

.faq-related-link {
    font-size: 0.8125rem;
    color: #CC0000;
    background-color: #FFF5F5;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #FFDDDD;
    transition: background-color 0.15s;
    /* Min tap target on mobile — WCAG 2.5.5 AAA */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.faq-related-link:hover {
    background-color: #FFEEEE;
    text-decoration: none;
}

/* ═══════════════════════════════════════════════
   Category Badge (inside expanded answer)
   ═══════════════════════════════════════════════ */

.faq-category-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: #666666;
    background-color: #F0F0F0;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 12px;
}

/* ═══════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 48px 16px;
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-icon {
    color: #CCCCCC;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.875rem;
    color: #666666;
    margin-bottom: 16px;
    line-height: 1.5;
}

.empty-state-support {
    font-size: 0.875rem;
    color: #666666;
}

.empty-state-support a {
    color: #CC0000;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════
   Loading State
   ═══════════════════════════════════════════════ */

.loading-state {
    text-align: center;
    padding: 48px 16px;
    color: #666666;
    font-size: 0.875rem;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E0E0E0;
    border-top-color: #000000;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-text {
    color: #EE0000;
}

/* ═══════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════ */

.footer {
    border-top: 1px solid #E0E0E0;
    padding: 24px 16px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    text-align: center;
}

.footer-support {
    max-width: 800px;
    margin: 0 auto;
}

.footer-support p {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 4px;
}

.footer-email-link {
    font-size: 0.9375rem;
    color: #CC0000;
    font-weight: 600;
}

.footer-version {
    font-size: 0.75rem;
    color: #999999;
    margin-top: 16px;
}

/* ═══════════════════════════════════════════════
   Back to Top
   ═══════════════════════════════════════════════ */

.back-to-top {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #000000;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Below sticky search (z:10), above all page content */
    z-index: 9;
    opacity: 0;
    /* visibility:hidden removes from tab order when not shown */
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #333333;
}

.back-to-top:focus-visible {
    outline: 2px solid #EE0000;
    outline-offset: 2px;
}

.back-to-top:active {
    transform: translateY(0) scale(0.92);
}

/* ═══════════════════════════════════════════════
   Tablet — 768px+
   ═══════════════════════════════════════════════ */

@media (min-width: 768px) {
    html {
        scroll-padding-top: 88px; /* Tablet: ~82px container + 6px buffer */
    }

    .header {
        padding: 28px 24px;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header-subtitle {
        font-size: 1rem;
    }

    .search-container {
        padding: 16px 24px;
    }

    .search-input {
        font-size: 16px;
        padding: 14px 44px 14px 44px;
    }

    .category-pills {
        padding: 0 24px;
    }

    .support-cta {
        padding: 16px 24px 0;
    }

    .category-pill {
        font-size: 0.875rem;
        padding: 8px 18px;
    }

    .faq-container {
        padding: 0 24px 32px;
    }

    .faq-header {
        font-size: 1rem;
        padding: 18px 0;
    }

    .faq-answer {
        font-size: 0.9375rem;
        padding: 20px;
    }

    .footer {
        padding: 32px 24px;
    }

    .back-to-top {
        bottom: calc(28px + env(safe-area-inset-bottom));
        right: 24px;
    }
}

/* ═══════════════════════════════════════════════
   Desktop — 1024px+
   ═══════════════════════════════════════════════ */

@media (min-width: 1024px) {
    html {
        scroll-padding-top: 96px; /* Desktop: ~90px container + 6px buffer */
    }

    .header {
        padding: 32px 32px;
    }

    .header-title {
        font-size: 1.75rem;
    }

    .search-container {
        padding: 20px 32px;
    }

    .category-pills {
        padding: 0 32px;
        justify-content: center;
    }

    .support-cta {
        padding: 16px 32px 0;
    }

    .faq-container {
        padding: 8px 32px 40px;
    }

    .faq-header {
        font-size: 1.0625rem;
    }

    .back-to-top {
        right: 32px;
    }
}

/* =============================================
   Copy-to-Clipboard Toast Notification
   ============================================= */

.copy-toast {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 11;
    background: rgba(51, 51, 51, 0.95);
    color: #FFFFFF;
    border-radius: 12px;
    padding: 12px 16px;
    max-width: calc(100vw - 32px);
    width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.copy-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.copy-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copy-toast-icon {
    flex-shrink: 0;
    line-height: 0;
}

.copy-toast-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.copy-toast-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
}

.copy-toast-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
    line-height: 1.3;
}

/* Cursor pointer for href-less email action elements */
.support-cta-btn,
.footer-email-link,
.empty-state-support a {
    cursor: pointer;
}

/* ═══════════════════════════════════════════════
   Screen Reader Only — visually hidden, accessible
   ═══════════════════════════════════════════════ */

.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;
}

/* ═══════════════════════════════════════════════
   Reduced Motion — WCAG 2.1 AA (vestibular disorders)
   ═══════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
