/* =========================================================
   WARAQATAK HELP CENTER DESIGN SYSTEM
   Arabic-first / RTL — High-Contrast, Accessible, Responsive
========================================================= */

/* --- Help Navigation & Header --- */
.help-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.help-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.help-brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.help-brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.help-brand-title:hover {
    color: var(--accent);
}

.help-brand-badge {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 0.775rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(49, 92, 82, 0.15);
    white-space: nowrap;
}

.help-nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.925rem;
}

.help-nav-links a {
    color: var(--text-soft);
    text-decoration: none;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.help-nav-links a:hover,
.help-nav-links a:focus-visible {
    color: var(--accent);
    outline: none;
}

.help-nav-links a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    font-size: 0.8125rem;
    color: var(--muted);
    margin: 16px 0 20px;
    line-height: 1.6;
}

.breadcrumbs a {
    color: var(--accent);
    text-decoration: none;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs .sep {
    color: var(--border-strong);
    user-select: none;
    font-size: 0.75rem;
}

.breadcrumbs .current {
    color: var(--text-soft);
    font-weight: 600;
}

/* --- Hero Banner --- */
.help-hero {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    padding: 36px 0 32px;
    text-align: center;
}

.help-hero h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.3rem);
    font-weight: 700;
    color: var(--text);
    margin: 0 0 10px;
    line-height: 1.3;
}

.help-hero p {
    font-size: 1.05rem;
    color: var(--text-soft);
    max-width: 660px;
    margin: 0 auto 24px;
    line-height: 1.7;
}

/* --- Search Component --- */
.help-search-container {
    max-width: 620px;
    margin: 0 auto;
    position: relative;
    width: 100%;
}

.help-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.help-search-input {
    width: 100%;
    height: 48px;
    padding: 0 46px 0 44px;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.help-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(49, 92, 82, 0.15);
}

.help-search-icon {
    position: absolute;
    right: 14px;
    width: 20px;
    height: 20px;
    color: var(--muted);
    pointer-events: none;
}

.help-search-clear {
    position: absolute;
    left: 8px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.help-search-clear:hover,
.help-search-clear:focus-visible {
    color: var(--text);
    background: var(--surface);
    outline: none;
}

.help-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    text-align: right;
    box-sizing: border-box;
}

.search-result-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
    background: var(--accent-soft);
    outline: none;
}

.search-result-item .item-cat {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-dark);
    margin-bottom: 2px;
}

.search-result-item .item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 2px;
}

.search-result-item .item-snippet {
    font-size: 0.825rem;
    color: var(--text-soft);
    margin: 0;
    line-height: 1.4;
}

.search-empty-state {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

/* --- Category Cards Grid --- */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 20px;
    margin: 28px 0 48px;
}

.help-card {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}

.help-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.help-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.help-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.help-card-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.help-card h2,
.help-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
    line-height: 1.35;
}

.help-card p {
    font-size: 0.8875rem;
    color: var(--text-soft);
    line-height: 1.6;
    margin: 0 0 16px;
    flex-grow: 1;
}

.help-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--accent);
    font-weight: 600;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.help-card-meta .arrow {
    display: inline-flex;
    align-items: center;
    transition: transform 0.15s ease;
}

.help-card:hover .help-card-meta .arrow {
    transform: translateX(-4px);
}

/* --- Article Detail Layout --- */
.article-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
    margin: 24px 0 56px;
}

.article-sidebar {
    position: sticky;
    top: 80px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}

.article-sidebar h3 {
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.article-toc {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-toc li {
    margin-bottom: 8px;
}

.article-toc li:last-child {
    margin-bottom: 0;
}

.article-toc a {
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.8375rem;
    line-height: 1.5;
    display: block;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.article-toc a:hover,
.article-toc a:focus-visible {
    color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

/* --- Article Content Body --- */
.article-content {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    min-width: 0;
    line-height: 1.8;
    color: var(--text);
    box-sizing: border-box;
}

.article-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
    margin-bottom: 28px;
}

.article-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.badge-tag,
.badge-version {
    font-size: 0.775rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-tag {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.badge-pro {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.badge-version {
    background: #F3F4F6;
    color: #4B5563;
    font-family: monospace;
    font-size: 0.75rem;
}

.article-header h1 {
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text);
    line-height: 1.35;
}

.article-lead {
    font-size: 1.05rem;
    color: var(--text-soft);
    margin: 0;
    line-height: 1.7;
}

.article-content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 36px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
}

.article-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 26px 0 10px;
    line-height: 1.45;
}

.article-content p {
    margin: 0 0 16px;
    max-width: 72ch;
}

.article-content ul,
.article-content ol {
    margin: 0 0 20px;
    padding-inline-start: 24px;
    max-width: 72ch;
}

.article-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

/* --- Step by Step Procedures --- */
.step-procedure {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.step-card {
    display: flex;
    gap: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-sizing: border-box;
}

.step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--white);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-body {
    flex: 1;
    min-width: 0;
}

.step-body h4 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.step-body p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-soft);
    line-height: 1.6;
}

/* --- Callout Alerts (Iconized & Accessible) --- */
.callout,
.note-box {
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin: 22px 0;
    border-inline-start: 4px solid;
    font-size: 0.925rem;
    line-height: 1.7;
    box-sizing: border-box;
}

.callout-title,
.note-box h4 {
    font-weight: 700;
    font-size: 0.975rem;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.callout-title svg,
.note-box svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.callout-note,
.note-box {
    background: #F0FDF4;
    border-color: #16A34A;
    color: #166534;
}

.callout-warning {
    background: #FFFBEB;
    border-color: #D97706;
    color: #92400E;
}

.callout-tip {
    background: #EFF6FF;
    border-color: #2563EB;
    color: #1E40AF;
}

.callout-pro {
    background: #FAF5FF;
    border-color: #9333EA;
    color: #6B21A8;
}

/* --- Trouble & Warning Items --- */
.trouble-item {
    border: 1px solid var(--border);
    border-inline-start: 4px solid var(--accent);
    border-radius: var(--radius-md);
    background: var(--bg);
    padding: 16px 18px;
    margin: 18px 0;
}

.trouble-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.trouble-title {
    font-weight: 700;
    font-size: 0.975rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.trouble-title svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.trouble-body {
    font-size: 0.9rem;
    color: var(--text-soft);
    line-height: 1.65;
}

.trouble-body p:last-child {
    margin-bottom: 0;
}

/* --- In-App Path Token --- */
.app-path {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    direction: rtl;
    white-space: nowrap;
}

/* --- Calculation & Formula Box --- */
.calc-box {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin: 18px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calc-formula {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-dark);
    direction: rtl;
    white-space: nowrap;
}

/* --- Tables & Responsive Wrappers --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-sizing: border-box;
}

.guide-table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    text-align: right;
    font-size: 0.9rem;
}

.guide-table th {
    background: var(--bg);
    color: var(--text);
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.guide-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    line-height: 1.5;
}

.guide-table tr:last-child td {
    border-bottom: none;
}

.guide-table tr:hover td {
    background: var(--surface);
}

/* Table status icons & badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.825rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.status-badge svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

.status-yes {
    background: #DCFCE7;
    color: #166534;
}

.status-no {
    background: #F3F4F6;
    color: #6B7280;
}

/* --- Article Footer & Escalation --- */
.article-footer {
    border-top: 1px solid var(--border);
    margin-top: 36px;
    padding-top: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.article-footer a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* =========================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
========================================================= */

/* Tablet & Smaller Desktops (<= 900px) */
@media (max-width: 900px) {
    .article-layout {
        display: flex;
        flex-direction: column;
        gap: 28px;
        margin: 20px 0 44px;
    }

    .article-content {
        order: 1;
        padding: 24px 22px;
    }

    .article-sidebar {
        order: 2;
        position: static;
        width: 100%;
        box-sizing: border-box;
    }

    .article-sidebar h3 {
        font-size: 0.9rem;
    }
}

/* Mobile Screens (<= 640px) */
@media (max-width: 640px) {
    .help-header {
        padding: 10px 0;
    }

    .help-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .help-nav-links {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        gap: 12px;
        padding-bottom: 2px;
    }

    .help-nav-links a {
        font-size: 0.85rem;
        padding: 4px 6px;
    }

    .help-hero {
        padding: 28px 0 24px;
    }

    .help-hero h1 {
        font-size: 1.5rem;
    }

    .help-hero p {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }

    .help-search-input {
        height: 44px;
        font-size: 0.95rem;
        padding: 0 40px 0 38px;
    }

    .help-search-icon {
        right: 12px;
        width: 18px;
        height: 18px;
    }

    .help-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 20px 0 36px;
    }

    .help-card {
        padding: 18px 16px;
    }

    .article-content {
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }

    .article-header {
        padding-bottom: 18px;
        margin-bottom: 20px;
    }

    .article-header h1 {
        font-size: 1.35rem;
    }

    .article-lead {
        font-size: 0.95rem;
    }

    .article-content h2 {
        font-size: 1.2rem;
        margin: 28px 0 12px;
    }

    .article-content h3 {
        font-size: 1.05rem;
        margin: 22px 0 8px;
    }

    .step-card {
        padding: 14px;
        gap: 12px;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .callout,
    .note-box,
    .trouble-item {
        padding: 14px 14px;
        margin: 16px 0;
    }

    .article-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Very Narrow Mobile (<= 360px - e.g. 320px) */
@media (max-width: 360px) {
    .container {
        padding-inline: 10px;
    }

    .help-brand-title {
        font-size: 1.05rem;
    }

    .help-brand-badge {
        font-size: 0.725rem;
        padding: 2px 7px;
    }

    .breadcrumbs {
        font-size: 0.775rem;
        gap: 4px 6px;
    }

    .article-content {
        padding: 16px 12px;
    }

    .article-header h1 {
        font-size: 1.25rem;
    }

    .guide-table th,
    .guide-table td {
        padding: 8px 10px;
        font-size: 0.825rem;
    }

    .app-path {
        white-space: normal;
        word-break: break-word;
    }
}

/* --- High Contrast & Print Optimization --- */
@media print {
    .help-header,
    .help-hero,
    .article-sidebar,
    .article-footer,
    footer {
        display: none !important;
    }
    .article-layout {
        display: block;
        margin: 0;
    }
    .article-content {
        border: none;
        padding: 0;
    }
}
