/* ═══════════════════════════════════
   ShiftMate – Home Assistant Page Styles
   ═══════════════════════════════════ */

/* ── Shared HA icons ─────────────── */
.ha-card-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--gradient-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ── HA Dropdowns ─────────────────── */
.ha-dropdown {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: all 0.35s;
}
.ha-dropdown:hover {
    border-color: var(--border-glow);
}
.ha-dropdown.open {
    border-color: rgba(100, 160, 255, 0.2);
    box-shadow: 0 8px 40px rgba(74, 108, 247, 0.08);
}
.ha-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 20px 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    text-align: left;
}
.ha-dropdown-title { flex: 1; }
.ha-dropdown-chevron {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(100, 140, 255, 0.06);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.35s, background 0.35s;
}
.ha-dropdown-chevron svg {
    width: 14px; height: 14px;
    stroke: var(--text-muted);
    transition: stroke 0.35s;
}
.ha-dropdown.open .ha-dropdown-chevron {
    transform: rotate(180deg);
    background: rgba(100, 160, 255, 0.12);
}
.ha-dropdown.open .ha-dropdown-chevron svg {
    stroke: var(--neon-cyan);
}
.ha-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.ha-steps {
    list-style: none;
    padding: 0 28px 24px;
    counter-reset: ha-step;
}
.ha-steps li {
    position: relative;
    padding: 12px 0 12px 44px;
    border-bottom: 1px solid rgba(100, 120, 255, 0.04);
    counter-increment: ha-step;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}
.ha-steps li:last-child { border-bottom: none; }
.ha-steps li::before {
    content: counter(ha-step);
    position: absolute;
    left: 0; top: 12px;
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--gradient-soft);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--neon-cyan);
    text-align: center;
    line-height: 28px;
}
.ha-steps li strong {
    display: block;
    font-weight: 600;
}
.ha-step-desc {
    display: block;
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 2px;
}

/* ── HA page content ───────────────── */
.ha-page-content {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 40px;
}

/* YAML download card */
.ha-yaml-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    backdrop-filter: blur(12px);
    transition: border-color 0.35s;
}
.ha-yaml-card:hover {
    border-color: var(--border-glow);
}
.ha-yaml-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.ha-yaml-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--gradient-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.ha-yaml-text {
    flex: 1;
    min-width: 200px;
}
.ha-yaml-text h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 6px;
}
.ha-yaml-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    hyphens: auto;
    hyphenate-limit-chars: 6 3 2;
}
.ha-yaml-desc p {
    margin-bottom: 10px;
}
.ha-yaml-desc code {
    background: rgba(100, 160, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
    color: var(--neon-cyan);
    white-space: nowrap;
}
.ha-yaml-desc .ha-code {
    margin: 10px 0;
}
.ha-yaml-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 999px;
    background: var(--gradient-main);
    color: #fff;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 20px rgba(74, 108, 247, 0.25);
    flex-shrink: 0;
    white-space: nowrap;
}
.ha-yaml-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(74, 108, 247, 0.35);
}
.ha-yaml-download-row {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

/* HA page sections */
.ha-page-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    backdrop-filter: blur(12px);
    transition: border-color 0.35s;
}
.ha-page-section:hover {
    border-color: var(--border-glow);
}
.ha-page-section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.ha-page-section-header h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin: 0;
}
.ha-page-section-body {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.85;
    overflow-x: auto;
    overflow-wrap: break-word;
    hyphens: auto;
    hyphenate-limit-chars: 6 3 2;
}
.ha-page-section-body > *:first-child {
    margin-top: 0;
}
.ha-page-section-body p {
    margin-bottom: 14px;
}
.ha-page-section-body ul,
.ha-page-section-body ol {
    margin-bottom: 14px;
}
.ha-page-section-body ul {
    list-style: none;
    padding-left: 0;
}
.ha-page-section-body ol {
    padding-left: 24px;
}
.ha-page-section-body ul li,
.ha-page-section-body ol li {
    position: relative;
    margin-bottom: 8px;
}
.ha-page-section-body ul li {
    padding-left: 20px;
}
.ha-page-section-body ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--neon-blue);
    opacity: 0.6;
}
.ha-page-section-body ol li {
    padding-left: 4px;
}
/* Nested lists inside ordered lists */
.ha-page-section-body ol ul {
    list-style: none;
    padding-left: 0;
    margin-top: 6px;
    margin-bottom: 6px;
}
.ha-page-section-body ol ul li {
    padding-left: 20px;
    margin-bottom: 6px;
}
.ha-page-section-body ol ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--neon-blue);
    opacity: 0.4;
}
.ha-page-section-body h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 24px 0 10px;
}
.ha-page-section-body h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 18px 0 8px;
}
.ha-page-section-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}
.ha-page-section-body strong {
    color: var(--text-primary);
}
.ha-page-section-body code {
    background: rgba(100, 160, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
    color: var(--neon-cyan);
    white-space: nowrap;
}

/* HA page tables */
.ha-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.9rem;
    table-layout: auto;
}
.ha-table th {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: rgba(100, 120, 255, 0.04);
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.ha-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(100, 120, 255, 0.04);
    color: var(--text-secondary);
    vertical-align: top;
}
.ha-table tr:last-child td {
    border-bottom: none;
}
.ha-table code {
    background: rgba(100, 160, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--neon-cyan);
    white-space: nowrap;
}

/* HA code blocks */
.ha-code {
    background: rgba(6, 6, 18, 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 16px 20px;
    margin: 12px 0;
    overflow-x: auto;
}
.ha-code code {
    background: none;
    padding: 0;
    font-size: 0.88rem;
    color: var(--neon-cyan);
    white-space: pre;
    line-height: 1.7;
}

/* HA dropdown content on the HA page */
.ha-page-dropdown-content {
    padding: 8px 28px 24px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.85;
    overflow-wrap: break-word;
    hyphens: auto;
    hyphenate-limit-chars: 6 3 2;
}
.ha-page-dropdown-content > *:first-child {
    margin-top: 0;
}
.ha-page-dropdown-content p {
    margin-bottom: 14px;
}
.ha-page-dropdown-content ul,
.ha-page-dropdown-content ol {
    margin-bottom: 14px;
}
.ha-page-dropdown-content ul {
    list-style: none;
    padding-left: 0;
}
.ha-page-dropdown-content ol {
    padding-left: 24px;
}
.ha-page-dropdown-content ul li,
.ha-page-dropdown-content ol li {
    position: relative;
    margin-bottom: 8px;
}
.ha-page-dropdown-content ul li {
    padding-left: 20px;
}
.ha-page-dropdown-content ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--neon-blue);
    opacity: 0.6;
}
.ha-page-dropdown-content ol li {
    padding-left: 4px;
}
/* Nested lists inside ordered lists */
.ha-page-dropdown-content ol ul {
    list-style: none;
    padding-left: 0;
    margin-top: 6px;
    margin-bottom: 6px;
}
.ha-page-dropdown-content ol ul li {
    padding-left: 20px;
    margin-bottom: 6px;
}
.ha-page-dropdown-content ol ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--neon-blue);
    opacity: 0.4;
}
.ha-page-dropdown-content h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 24px 0 10px;
}
.ha-page-dropdown-content h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 18px 0 8px;
}
.ha-page-dropdown-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}
.ha-page-dropdown-content strong {
    color: var(--text-primary);
}
.ha-page-dropdown-content code {
    background: rgba(100, 160, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
    color: var(--neon-cyan);
    white-space: nowrap;
}
.ha-page-dropdown-content .ha-table {
    margin: 14px 0;
}

/* ── Responsive ───────────────────── */
@media (max-width: 768px) {
    /* Page content */
    .ha-page-content { padding: 0 6px; gap: 12px; }

    /* Dropdown toggles */
    .ha-dropdown-toggle { padding: 14px 14px; gap: 10px; font-size: 0.92rem; }
    .ha-dropdown-toggle .ha-card-icon { width: 32px; height: 32px; font-size: 0.95rem; }
    .ha-steps { padding: 0 14px 14px; }
    .ha-steps li { padding-left: 36px; }

    /* YAML download */
    .ha-yaml-card { padding: 18px 14px; }
    .ha-yaml-inner { flex-direction: column; align-items: flex-start; }
    .ha-yaml-btn { width: 100%; justify-content: center; }
    .ha-yaml-desc { font-size: 0.88rem; line-height: 1.7; }
    .ha-yaml-desc code { font-size: 0.85rem; }

    /* Sections */
    .ha-page-section { padding: 18px 12px; }
    .ha-page-section-header { gap: 10px; margin-bottom: 16px; }
    .ha-page-section-header h2 { font-size: 1.1rem; }
    .ha-page-section-body { font-size: 0.9rem; line-height: 1.8; }

    /* Section body lists */
    .ha-page-section-body ul li { padding-left: 16px; }
    .ha-page-section-body ol { padding-left: 20px; }
    .ha-page-section-body ol li { padding-left: 2px; }
    .ha-page-section-body ol ul { margin-left: 0; }
    .ha-page-section-body ol ul li { padding-left: 16px; }
    .ha-page-section-body h3 { font-size: 1rem; margin: 18px 0 8px; }
    .ha-page-section-body h4 { font-size: 0.95rem; margin: 14px 0 6px; }

    /* Dropdown content */
    .ha-page-dropdown-content { padding: 6px 12px 16px; font-size: 0.9rem; line-height: 1.8; }
    .ha-page-dropdown-content ul li { padding-left: 16px; }
    .ha-page-dropdown-content ol { padding-left: 20px; }
    .ha-page-dropdown-content ol li { padding-left: 2px; }
    .ha-page-dropdown-content ol ul { margin-left: 0; }
    .ha-page-dropdown-content ol ul li { padding-left: 16px; }
    .ha-page-dropdown-content h3 { font-size: 1rem; margin: 18px 0 8px; }
    .ha-page-dropdown-content h4 { font-size: 0.95rem; margin: 14px 0 6px; }

    /* Tables: scroll horizontally, don't break code */
    .ha-page-section-body .ha-table,
    .ha-page-dropdown-content .ha-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px;
    }
    .ha-table th, .ha-table td { padding: 8px 10px; font-size: 0.8rem; }
    .ha-table code { font-size: 0.78rem; padding: 1px 4px; }

    /* Code blocks: scroll horizontally, never wrap */
    .ha-code {
        padding: 12px 14px;
        margin-left: -12px;
        margin-right: -12px;
        border-radius: var(--radius-xs);
    }
    .ha-code code {
        white-space: pre;
        font-size: 0.82rem;
    }

    /* Inline code: allow wrapping on mobile at reasonable points */
    .ha-page-section-body code,
    .ha-page-dropdown-content code {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}