/*
Theme Name: TitanCart Helpdesk
Theme URI: https://titancart.io
Description: Documentation and help center theme for TitanCart. Clean knowledge base layout with integrated ticket system.
Version: 1.0.0
Author: TitanCart
Author URI: https://titancart.io
Text Domain: tchd-theme
Requires at least: 6.0
Requires PHP: 8.0
License: GPL v2 or later
*/

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --tchd-navy: #0E2B53;
    --tchd-blue: #1F6AE1;
    --tchd-blue-light: #EEF4FE;
    --tchd-blue-hover: #1858C1;
    --tchd-success: #1F8A70;
    --tchd-amber: #D9A441;
    --tchd-error: #C84646;
    --tchd-text: #1C2430;
    --tchd-muted: #5A6270;
    --tchd-light-muted: #9CA3AF;
    --tchd-bg: #F7F8FB;
    --tchd-card: #FFFFFF;
    --tchd-border: #E8ECF1;
    --tchd-radius: 12px;
    --tchd-radius-sm: 8px;
    --tchd-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --tchd-shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --tchd-max-width: 1200px;
    --tchd-header-height: 64px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--tchd-text);
    background: var(--tchd-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--tchd-blue); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--tchd-blue-hover); }

img { max-width: 100%; height: auto; display: block; }

.tchd-container {
    max-width: var(--tchd-max-width);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* ── Header ── */
.tchd-header {
    background: var(--tchd-card);
    border-bottom: 1px solid var(--tchd-border);
    height: var(--tchd-header-height);
    position: sticky;
    top: 0;
    z-index: 100;
}
.tchd-header .tchd-container {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 32px;
}
.tchd-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.tchd-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--tchd-blue), #3B82F6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(31,106,225,0.22);
}
.tchd-logo-text {
    font-weight: 700;
    font-size: 17px;
    color: var(--tchd-text);
    letter-spacing: -0.3px;
}
.tchd-logo-text span {
    color: var(--tchd-muted);
    font-weight: 400;
    font-size: 13px;
    margin-left: 6px;
}

.tchd-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tchd-nav a {
    padding: 8px 14px;
    border-radius: var(--tchd-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--tchd-muted);
    transition: all 0.15s ease;
}
.tchd-nav a:hover,
.tchd-nav a.active {
    color: var(--tchd-text);
    background: var(--tchd-bg);
}

.tchd-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.tchd-header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--tchd-bg);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius-sm);
    padding: 7px 14px;
    width: 240px;
    transition: border-color 0.15s ease;
}
.tchd-header-search:focus-within {
    border-color: var(--tchd-blue);
    box-shadow: 0 0 0 3px rgba(31,106,225,0.08);
}
.tchd-header-search svg { flex-shrink: 0; color: var(--tchd-light-muted); }
.tchd-header-search input {
    border: none;
    background: none;
    font-size: 13px;
    color: var(--tchd-text);
    outline: none;
    width: 100%;
    font-family: inherit;
}
.tchd-header-search input::placeholder { color: var(--tchd-light-muted); }

.tchd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--tchd-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}
.tchd-btn-primary { background: var(--tchd-blue); color: #fff; }
.tchd-btn-primary:hover { background: var(--tchd-blue-hover); color: #fff; }
.tchd-btn-outline { background: transparent; color: var(--tchd-blue); border: 1px solid var(--tchd-border); }
.tchd-btn-outline:hover { border-color: var(--tchd-blue); background: var(--tchd-blue-light); }

/* ── Mobile nav toggle ── */
.tchd-mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    color: var(--tchd-muted);
}

/* ── Breadcrumb ── */
.tchd-breadcrumb {
    padding: 16px 0;
    font-size: 13px;
    color: var(--tchd-light-muted);
}
.tchd-breadcrumb a { color: var(--tchd-muted); }
.tchd-breadcrumb a:hover { color: var(--tchd-blue); }
.tchd-breadcrumb span { margin: 0 6px; color: var(--tchd-border); }

/* ── Hero ── */
.tchd-hero {
    text-align: center;
    padding: 48px 0 40px;
}
.tchd-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.tchd-hero-badge img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}
.tchd-hero h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    color: var(--tchd-text);
}
.tchd-hero p {
    font-size: 16px;
    color: var(--tchd-muted);
    max-width: 560px;
    margin: 0 auto 28px;
}
.tchd-hero-search {
    max-width: 520px;
    margin: 0 auto;
    position: relative;
}
.tchd-hero-search input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 1px solid var(--tchd-border);
    border-radius: 50px;
    font-size: 15px;
    font-family: inherit;
    color: var(--tchd-text);
    background: var(--tchd-card);
    box-shadow: var(--tchd-shadow-md);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tchd-hero-search input:focus {
    border-color: var(--tchd-blue);
    box-shadow: var(--tchd-shadow-md), 0 0 0 3px rgba(31,106,225,0.08);
}
.tchd-hero-search input::placeholder { color: var(--tchd-light-muted); }
.tchd-hero-search svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tchd-light-muted);
}
.tchd-hero-search .tchd-search-hint {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--tchd-light-muted);
    background: var(--tchd-bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--tchd-border);
}

/* ── Category Cards Grid ── */
.tchd-cats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding-bottom: 60px;
}
.tchd-cat-card {
    background: var(--tchd-card);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius);
    padding: 28px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.tchd-cat-card:hover {
    box-shadow: var(--tchd-shadow-md);
    border-color: #D0D5DD;
}
.tchd-cat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.tchd-cat-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}
.tchd-cat-card-header h3 a {
    color: var(--tchd-text);
}
.tchd-cat-card-header h3 a:hover {
    color: var(--tchd-blue);
}
.tchd-cat-count {
    font-size: 12px;
    color: var(--tchd-muted);
    background: var(--tchd-bg);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    font-weight: 500;
}
.tchd-cat-articles {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}
.tchd-cat-articles li {
    padding: 7px 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: 14px;
}
.tchd-cat-articles li:last-child { border-bottom: none; }
.tchd-cat-articles li a {
    color: var(--tchd-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tchd-cat-articles li a:hover { color: var(--tchd-blue); }
.tchd-cat-articles li a::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--tchd-border);
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.tchd-cat-articles li a:hover::before { background: var(--tchd-blue); }

.tchd-show-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--tchd-blue);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tchd-show-all:hover { text-decoration: underline; }

/* ── Quick Links Bar ── */
.tchd-quick-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 0 0 48px;
    flex-wrap: wrap;
}
.tchd-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--tchd-card);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--tchd-text);
    transition: all 0.15s ease;
}
.tchd-quick-link:hover {
    border-color: var(--tchd-blue);
    color: var(--tchd-blue);
    box-shadow: var(--tchd-shadow);
}
.tchd-quick-link svg { color: var(--tchd-blue); flex-shrink: 0; }

/* ── Page Content ── */
.tchd-page-content {
    flex: 1;
}
.tchd-page-wrap {
    padding: 40px 0 60px;
}
.tchd-article-content {
    background: var(--tchd-card);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius);
    padding: 40px;
    max-width: 860px;
    margin: 0 auto;
    box-shadow: var(--tchd-shadow);
}
.tchd-article-content h1 { font-size: 28px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.3px; }
.tchd-article-content h2 { font-size: 22px; font-weight: 700; margin: 32px 0 12px; letter-spacing: -0.2px; }
.tchd-article-content h3 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.tchd-article-content p { margin-bottom: 16px; color: var(--tchd-muted); line-height: 1.7; }
.tchd-article-content ul, .tchd-article-content ol { margin: 0 0 16px 20px; color: var(--tchd-muted); }
.tchd-article-content li { margin-bottom: 6px; line-height: 1.6; }
.tchd-article-content img { border-radius: var(--tchd-radius-sm); margin: 16px 0; }
.tchd-article-content code {
    background: var(--tchd-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--tchd-navy);
}
.tchd-article-content pre {
    background: var(--tchd-navy);
    color: #E1E4EA;
    padding: 20px;
    border-radius: var(--tchd-radius-sm);
    overflow-x: auto;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
}
.tchd-article-content pre code { background: none; color: inherit; padding: 0; }
.tchd-article-content blockquote {
    border-left: 3px solid var(--tchd-blue);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--tchd-blue-light);
    border-radius: 0 var(--tchd-radius-sm) var(--tchd-radius-sm) 0;
    color: var(--tchd-text);
}
.tchd-article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tchd-border);
    font-size: 13px;
    color: var(--tchd-light-muted);
}
.tchd-article-meta svg { width: 14px; height: 14px; }

/* ── Sidebar Layout (for single docs) ── */
.tchd-docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    padding: 32px 0 60px;
    align-items: flex-start;
}
.tchd-sidebar {
    position: sticky;
    top: calc(var(--tchd-header-height) + 24px);
}
.tchd-sidebar-nav {
    background: var(--tchd-card);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius);
    padding: 8px;
    list-style: none;
}
.tchd-sidebar-nav a {
    display: block;
    padding: 9px 14px;
    font-size: 13.5px;
    color: var(--tchd-muted);
    border-radius: 6px;
    font-weight: 400;
    transition: all 0.12s ease;
}
.tchd-sidebar-nav a:hover { color: var(--tchd-text); background: var(--tchd-bg); }
.tchd-sidebar-nav a.active { color: var(--tchd-blue); background: var(--tchd-blue-light); font-weight: 500; }
.tchd-sidebar-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--tchd-light-muted);
    padding: 16px 14px 6px;
}

/* ── Article List (archive) ── */
.tchd-article-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tchd-article-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--tchd-card);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius-sm);
    color: var(--tchd-text);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
}
.tchd-article-list-item:hover {
    border-color: var(--tchd-blue);
    color: var(--tchd-blue);
    box-shadow: var(--tchd-shadow);
}
.tchd-article-list-item svg { color: var(--tchd-light-muted); flex-shrink: 0; }

/* ── Search Results ── */
.tchd-search-results { padding: 32px 0 60px; }
.tchd-search-results h1 { font-size: 24px; font-weight: 700; margin-bottom: 24px; }
.tchd-search-results .tchd-no-results { text-align: center; padding: 60px 0; color: var(--tchd-muted); }

/* ── Footer ── */
.tchd-footer {
    background: var(--tchd-card);
    border-top: 1px solid var(--tchd-border);
    padding: 24px 0;
    margin-top: auto;
}
.tchd-footer .tchd-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tchd-footer-text {
    font-size: 13px;
    color: var(--tchd-light-muted);
}
.tchd-footer-links {
    display: flex;
    gap: 20px;
    list-style: none;
}
.tchd-footer-links a {
    font-size: 13px;
    color: var(--tchd-muted);
    font-weight: 500;
}
.tchd-footer-links a:hover { color: var(--tchd-blue); }

/* ── Helpdesk page ── */
.tchd-helpdesk-page { padding: 32px 0 60px; }

/* ── Responsive ── */
@media (max-width: 960px) {
    .tchd-cats-grid { grid-template-columns: repeat(2, 1fr); }
    .tchd-docs-layout { grid-template-columns: 1fr; }
    .tchd-sidebar { position: static; }
}
@media (max-width: 640px) {
    .tchd-cats-grid { grid-template-columns: 1fr; }
    .tchd-hero h1 { font-size: 24px; }
    .tchd-header-search { display: none; }
    .tchd-nav { display: none; }
    .tchd-mobile-toggle { display: flex; }
    .tchd-nav.open { display: flex; flex-direction: column; position: absolute; top: var(--tchd-header-height); left: 0; right: 0; background: var(--tchd-card); border-bottom: 1px solid var(--tchd-border); padding: 12px; box-shadow: var(--tchd-shadow-md); z-index: 99; }
    .tchd-article-content { padding: 24px 20px; }
    .tchd-quick-links { flex-direction: column; align-items: stretch; }
    .tchd-footer .tchd-container { flex-direction: column; gap: 12px; text-align: center; }
}

/* ── WordPress admin bar offset ── */
.admin-bar .tchd-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .tchd-header { top: 46px; } }

/* ── Auth Page (Login & Register) ── */
.tchd-auth-page {
    max-width: 920px;
    margin: 0 auto;
    padding: 20px 0 60px;
}
.tchd-auth-tabs {
    display: none;
    gap: 4px;
    background: var(--tchd-bg);
    border: 1px solid var(--tchd-border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}
.tchd-auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tchd-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}
.tchd-auth-tab.active {
    background: var(--tchd-card);
    color: var(--tchd-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tchd-auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: flex-start;
}
.tchd-auth-card {
    background: var(--tchd-card);
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius);
    padding: 36px;
    box-shadow: var(--tchd-shadow);
}
.tchd-auth-card h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.3px;
}
.tchd-auth-desc {
    font-size: 14px;
    color: var(--tchd-muted);
    margin-bottom: 24px;
}
.tchd-auth-error {
    background: #FEF0EE;
    color: var(--tchd-error);
    border: 1px solid #F5D0D0;
    border-radius: var(--tchd-radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}
.tchd-auth-field {
    margin-bottom: 18px;
}
.tchd-auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tchd-text);
}
.tchd-auth-field input[type="text"],
.tchd-auth-field input[type="email"],
.tchd-auth-field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--tchd-border);
    border-radius: var(--tchd-radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--tchd-text);
    background: var(--tchd-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}
.tchd-auth-field input:focus {
    border-color: var(--tchd-blue);
    box-shadow: 0 0 0 3px rgba(31,106,225,0.08);
}
.tchd-auth-field input::placeholder { color: var(--tchd-light-muted); }
.tchd-auth-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.tchd-auth-field-header label { margin-bottom: 0; }
.tchd-forgot-link {
    font-size: 12px;
    color: var(--tchd-blue);
    font-weight: 500;
}
.tchd-auth-remember {
    margin-bottom: 20px;
}
.tchd-auth-remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tchd-muted);
    cursor: pointer;
}
.tchd-auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--tchd-blue);
    cursor: pointer;
}
.tchd-auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.tchd-auth-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--tchd-blue);
    color: #fff;
    border: none;
    border-radius: var(--tchd-radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}
.tchd-auth-btn:hover { background: var(--tchd-blue-hover); }
.tchd-auth-terms {
    font-size: 12px;
    color: var(--tchd-light-muted);
    margin: 0 0 20px;
    line-height: 1.5;
}
.tchd-auth-terms a { color: var(--tchd-blue); }
.tchd-auth-switch {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--tchd-border);
    font-size: 13px;
    color: var(--tchd-muted);
}
.tchd-auth-switch a { font-weight: 600; color: var(--tchd-blue); }

@media (max-width: 768px) {
    .tchd-auth-tabs { display: flex; }
    .tchd-auth-grid { grid-template-columns: 1fr; }
    .tchd-auth-card { padding: 28px 24px; }
    .tchd-auth-row { grid-template-columns: 1fr; }
}
