/**
 * TicketYA — Public-site stylesheet.
 *
 * Scoped under .tyx-* (public exclusive) and .ty-* (shared with admin).
 *
 * TABLE OF CONTENTS
 *   1. CSS variables (palette, fonts, radii, shadows)
 *   2. Base resets
 *   3. Header (logo + horizontal nav)
 *   4. Buttons
 *   5. Main column + page heading
 *   6. Card (default content surface)
 *   7. Forms + inputs + hints + actions
 *   8. Alerts (flash messages)
 *   9. FAQ accordion
 *  10. Knowledge base grid + cards
 *  11. KB article view
 *  12. Customer ticket view (header + status pill + thread bubbles)
 *  13. Footer
 *  14. File upload (drag & drop) — shared with admin
 *  15. Attachment gallery + lightbox
 *  16. Auth layout (login / forgot / reset)
 *  17. Responsive (≤ 700px)
 *
 * @package TicketYA\Assets\Public
 */


/* ════ 1. CSS variables ═══════════════════════════════════════════ */
:root {
    --ty-primary:       #4F46E5;
    --ty-primary-dark:  #4338CA;
    --ty-primary-soft:  rgba(79, 70, 229, 0.08);
    --ty-bg:            #F8F9FC;
    --ty-card:          #FFFFFF;
    --ty-text:          #111827;
    --ty-muted:         #6B7280;
    --ty-border:        #E5E7EB;
    --ty-success:       #10B981;
    --ty-warn:          #F59E0B;
    --ty-error:         #DC2626;
    --ty-radius:        10px;
    --ty-shadow:        0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
    --ty-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}


/* ════ 2. Base resets ═════════════════════════════════════════════ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--ty-font);
    color: var(--ty-text);
    background: var(--ty-bg);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a       { color: var(--ty-primary);      text-decoration: none; }
a:hover { color: var(--ty-primary-dark); }


/* ════ 3. Header (logo + horizontal nav) ══════════════════════════ */
.tyx-header {
    background: #fff;
    border-bottom: 1px solid var(--ty-border);
    padding: 14px 0;
    position: sticky; top: 0; z-index: 50;
}
.tyx-header__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center; justify-content: space-between;
    gap: 24px;
}
.tyx-logo {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 18px;
    color: var(--ty-text);
}
.tyx-logo__mark {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ty-primary), var(--ty-primary-dark));
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; letter-spacing: 0.5px;
}
.tyx-nav { display: flex; align-items: center; gap: 6px; }
.tyx-nav a {
    padding: 8px 14px;
    border-radius: 6px;
    color: var(--ty-muted);
    font-weight: 500; font-size: 14px;
}
.tyx-nav a:hover { background: #F3F4F6; color: var(--ty-text); }
.tyx-nav a.is-active {
    color: var(--ty-primary);
    position: relative;
    background: transparent;
}
.tyx-nav a.is-active::after {
    content: '';
    position: absolute;
    left: 14px; right: 14px; bottom: 0;
    height: 2px;
    background: var(--ty-primary);
    border-radius: 2px;
}
.tyx-nav .tyx-btn { margin-left: 8px; }


/* ════ 4. Buttons ═════════════════════════════════════════════════ */
/* Explicit :link/:visited rules so visited-link colour doesn't
 * override the brand on <a> buttons. */
.tyx-btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px; font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    font-family: inherit;
}
.tyx-btn--primary,
a.tyx-btn--primary,
a.tyx-btn--primary:link,
a.tyx-btn--primary:visited { background: var(--ty-primary); color: #fff; }
.tyx-btn--primary:hover,
a.tyx-btn--primary:hover,
a.tyx-btn--primary:focus  { background: var(--ty-primary-dark); color: #fff; }
.tyx-btn--ghost,
a.tyx-btn--ghost,
a.tyx-btn--ghost:link,
a.tyx-btn--ghost:visited  { background: transparent; color: var(--ty-text); border-color: var(--ty-border); }
.tyx-btn--ghost:hover,
a.tyx-btn--ghost:hover    { background: #F9FAFB; color: var(--ty-text); }
.tyx-btn--block { display: flex; width: 100%; }
.tyx-btn--sm    { padding: 6px 12px; font-size: 13px; }


/* ════ 5. Main column + page heading ══════════════════════════════ */
main.tyx-main {
    flex: 1;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}
.tyx-page-head { text-align: center; margin-bottom: 28px; }
.tyx-page-head h1 {
    font-size: 28px; font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.tyx-page-head p { color: var(--ty-muted); margin: 0; }


/* ════ 6. Card ════════════════════════════════════════════════════ */
.tyx-card {
    background: var(--ty-card);
    border: 1px solid var(--ty-border);
    border-radius: var(--ty-radius);
    box-shadow: var(--ty-shadow);
    padding: 32px;
    max-width: 720px;
    margin: 0 auto;
}
.tyx-card--narrow { max-width: 460px; }
.tyx-card--wide   { max-width: 1024px; }


/* ════ 7. Forms + inputs + hints + actions ════════════════════════ */
.tyx-form               { display: flex; flex-direction: column; gap: 16px; }
.tyx-form__row          { display: flex; flex-direction: column; gap: 6px; }
.tyx-form__row--double  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tyx-form__row label,
.tyx-label              { font-size: 13px; font-weight: 600; color: var(--ty-text); }
.tyx-form__row .req     { color: var(--ty-error); margin-left: 2px; }

.tyx-input, .tyx-select, .tyx-textarea {
    width: 100%;
    border: 1px solid var(--ty-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tyx-textarea { min-height: 140px; resize: vertical; }
.tyx-input:focus, .tyx-select:focus, .tyx-textarea:focus {
    border-color: var(--ty-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.tyx-hint { color: var(--ty-muted); font-size: 12px; }

.tyx-actions          { display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end; align-items: center; }
.tyx-actions--center  { justify-content: center; }


/* ════ 8. Alerts (flash messages) ═════════════════════════════════ */
.tyx-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid;
}
.tyx-alert--success { background: rgba(16,185,129,0.07); color: #047857;           border-color: rgba(16,185,129,0.3); }
.tyx-alert--error   { background: rgba(220,38,38,0.07);  color: var(--ty-error);   border-color: rgba(220,38,38,0.3); }
.tyx-alert--info    { background: rgba(79,70,229,0.07);  color: var(--ty-primary); border-color: rgba(79,70,229,0.3); }


/* ════ 9. FAQ accordion ═══════════════════════════════════════════ */
/* .tyx-faq__item--open toggled by public.js via event delegation. */
.tyx-faq { display: flex; flex-direction: column; gap: 10px; max-width: 820px; margin: 0 auto; }
.tyx-faq__item {
    background: #fff;
    border: 1px solid var(--ty-border);
    border-radius: var(--ty-radius);
    overflow: hidden;
}
.tyx-faq__q {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    user-select: none;
    background: #fff;
    border: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.tyx-faq__q:hover { background: #FAFAFC; }
.tyx-faq__icon { color: var(--ty-muted); transition: transform 0.2s; }
.tyx-faq__item--open .tyx-faq__icon { transform: rotate(45deg); color: var(--ty-primary); }
.tyx-faq__a { padding: 0 20px 18px; color: var(--ty-muted); display: none; }
.tyx-faq__item--open .tyx-faq__a { display: block; }


/* ════ 10. Knowledge base grid + cards ════════════════════════════ */
.tyx-kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}
.tyx-kb-card {
    background: #fff;
    border: 1px solid var(--ty-border);
    border-radius: var(--ty-radius);
    padding: 22px;
}
.tyx-kb-card h3 { margin: 0 0 14px; font-size: 17px; }
.tyx-kb-card ul {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.tyx-kb-card ul a {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px;
    color: var(--ty-primary);
}
.tyx-kb-card ul a:hover { color: var(--ty-primary-dark); }


/* ════ 11. KB article view ════════════════════════════════════════ */
.tyx-article {
    max-width: 760px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--ty-border);
    border-radius: var(--ty-radius);
    padding: 36px;
}
.tyx-article h1            { font-size: 26px; margin: 0 0 16px; }
.tyx-article .meta         { color: var(--ty-muted); font-size: 13px; margin-bottom: 24px; }
.tyx-article .content      { font-size: 15px; line-height: 1.7; }
.tyx-article .content p    { margin: 0 0 14px; }
.tyx-article .content h2   { font-size: 20px; margin-top: 24px; }


/* ════ 12. Customer ticket view ═══════════════════════════════════ */
/* --staff bubble = brand tint, sets agent replies apart. */
.tyx-ticket-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 18px;
}
.tyx-ticket-head h1       { margin: 0; font-size: 22px; }
.tyx-ticket-head__meta    { color: var(--ty-muted); font-size: 13px; }
.tyx-status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: var(--ty-primary-soft);
    color: var(--ty-primary);
}

.tyx-thread {
    display: flex; flex-direction: column; gap: 16px;
    max-width: 800px;
    margin: 0 auto 24px;
}
.tyx-bubble {
    background: #fff;
    border: 1px solid var(--ty-border);
    border-radius: 12px;
    padding: 16px 18px;
}
.tyx-bubble--staff { background: var(--ty-primary-soft); border-color: rgba(79,70,229,0.18); }
.tyx-bubble__head   { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.tyx-bubble__author { font-weight: 600; }
.tyx-bubble__time   { color: var(--ty-muted); font-size: 12px; }
.tyx-bubble__body   { font-size: 14px; line-height: 1.6; }
.tyx-bubble__body p { margin: 0 0 8px; }

.tyx-attachments { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tyx-attachments a {
    background: #fff;
    border: 1px solid var(--ty-border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--ty-text);
}


/* ════ 13. Footer ═════════════════════════════════════════════════ */
.tyx-footer {
    border-top: 1px solid var(--ty-border);
    background: #fff;
    text-align: center;
    padding: 18px 24px;
    color: var(--ty-muted);
    font-size: 13px;
}


/* ════ 14. File upload (drag & drop) — shared with admin.css ═════ */
.ty-fileup { display: flex; flex-direction: column; gap: 10px; }
.ty-fileup__drop {
    border: 2px dashed var(--ty-border);
    border-radius: 10px;
    padding: 22px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ty-muted);
    cursor: pointer;
    background: #FAFAFC;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: border-color 0.15s, background 0.15s;
}
.ty-fileup__drop:hover, .ty-fileup__drop.is-over {
    border-color: var(--ty-primary);
    background: rgba(79,70,229,0.04);
    color: var(--ty-text);
}
.ty-fileup__drop strong { font-weight: 600; color: var(--ty-text); }
.ty-fileup__icon-cloud {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--ty-primary-soft);
    color: var(--ty-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    margin-bottom: 4px;
}
.ty-fileup__hint { color: #9CA3AF; font-size: 12px; margin-top: 2px; }
.ty-fileup__list { display: flex; flex-direction: column; gap: 6px; }
.ty-fileup__item {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid var(--ty-border);
    border-radius: 8px;
}
.ty-fileup__thumb {
    width: 36px; height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.ty-fileup__icon {
    font-size: 22px;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
}
.ty-fileup__meta { flex: 1; min-width: 0; }
.ty-fileup__name {
    font-size: 13px; font-weight: 600;
    color: var(--ty-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ty-fileup__size { font-size: 11px; color: var(--ty-muted); }


/* ════ 15. Attachment gallery + lightbox ══════════════════════════ */
.ty-attach-gallery {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 10px;
}
.ty-attach-thumb {
    width: 72px; height: 72px;
    border: 1px solid var(--ty-border);
    border-radius: 8px;
    background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    text-decoration: none;
    color: var(--ty-text);
}
.ty-attach-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.ty-attach-thumb--file {
    flex-direction: column;
    font-size: 10px; text-align: center;
    padding: 6px; gap: 2px;
    color: var(--ty-muted);
    cursor: pointer;
}
.ty-attach-thumb--file .ico   { font-size: 22px; }
.ty-attach-thumb--file .label { font-size: 9px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-attach-thumb:hover { border-color: var(--ty-primary); }

.ty-lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.86);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
    padding: 30px;
    flex-direction: column;
}
.ty-lightbox.is-open { display: flex; }
.ty-lightbox__img {
    max-width: 95vw; max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.ty-lightbox__close {
    position: absolute;
    top: 18px; right: 22px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 24px; line-height: 1;
    cursor: pointer;
}
.ty-lightbox__close:hover { background: rgba(255,255,255,0.3); }
.ty-lightbox__dl {
    margin-top: 16px;
    padding: 8px 16px;
    background: #fff;
    color: #111;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    text-decoration: none;
}
.ty-lightbox__dl:hover { background: var(--ty-primary); color: #fff; }


/* ════ 16. Auth layout (login / forgot / reset) ═══════════════════ */
body.tyx-auth-body {
    background: linear-gradient(135deg, rgba(79,70,229,0.06), rgba(99,102,241,0.04) 60%, #F8F9FC);
}
.tyx-auth {
    display: flex; align-items: center; justify-content: center;
    flex: 1;
    padding: 60px 20px;
}
.tyx-auth__card {
    max-width: 420px;
    width: 100%;
    background: #fff;
    border: 1px solid var(--ty-border);
    border-radius: var(--ty-radius);
    box-shadow: var(--ty-shadow);
    padding: 32px;
}
.tyx-auth__brand {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 28px;
    justify-content: center;
}
.tyx-auth__brand .tyx-logo__mark { width: 40px; height: 40px; font-size: 14px; }
.tyx-auth__brand .name           { font-weight: 700; font-size: 18px; }
.tyx-auth__logo                  { display: block; height: 48px; width: auto; max-width: 220px; object-fit: contain; }
.tyx-auth__title {
    font-size: 22px; font-weight: 700;
    margin: 0 0 6px;
    text-align: center;
}
.tyx-auth__sub {
    color: var(--ty-muted);
    text-align: center;
    margin: 0 0 24px;
    font-size: 14px;
}
.tyx-auth__foot {
    text-align: center;
    margin-top: 20px;
    color: var(--ty-muted);
    font-size: 13px;
}


/* ════ 17. Responsive ═════════════════════════════════════════════ */
@media (max-width: 700px) {
    .tyx-form__row--double { grid-template-columns: 1fr; }
    .tyx-card              { padding: 22px; }
    .tyx-page-head h1      { font-size: 22px; }
    .tyx-nav               { flex-wrap: wrap; }
    .tyx-nav a             { padding: 6px 10px; font-size: 13px; }
}
