/* =====================================================================
   HELPDESK - Estilos base e área pública
   ===================================================================== */

:root {
    --color-primary-light: #4569c9;
    --color-primary: #3f64c8;
    --color-accent: #0d6efd;
    --color-bg: #f4f5f7;
    --color-card-bg: #ffffff;
    --color-border: #e2e4e8;
    --color-text: #1f2a44;
    --color-text-muted: #6b7280;
    --color-success: #198754;
    --color-error: #dc3545;
    --radius: 8px;
    --font: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header público */
.site-header {
    background: var(--color-primary);
    color: #fff;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    border: 2px solid #fff;
    padding: 5px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 116px; height: auto; }
.main-nav a {
    color: #dfe3ea;
    margin-left: 16px;
    font-size: 14px;
}
.main-nav a:hover { color: #fff; }
.nav-admin-link {
    border: 1px solid rgba(255,255,255,0.4);
    padding: 6px 12px;
    border-radius: var(--radius);
}

.main-content { padding: 32px 20px 60px; }

.site-footer {
    background: #fff;
    border-top: 1px solid var(--color-border);
    padding: 20px 0;
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
}

/* Cards / formulários */
.card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.form-card { max-width: 640px; margin: 0 auto; }
.success-card, .error-card { text-align: center; max-width: 500px; margin: 40px auto; }

.subtitle { color: var(--color-text-muted); margin-top: -8px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=file], input[type=color],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}
textarea { resize: vertical; }
small { color: var(--color-text-muted); font-size: 12px; display: block; margin-top: 4px; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: #0b5ed7; text-decoration: none; }
.btn-secondary { background: #e9ecef; color: var(--color-text); }
.btn-secondary:hover { background: #dde1e6; text-decoration: none; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #bb2d3b; text-decoration: none; }
.btn-block { width: 100%; text-align: center; }
.btn-link { background: none; border: none; color: var(--color-accent); cursor: pointer; font-size: 13px; padding: 0; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1f2e0; color: #0f5132; }
.alert-error { background: #f8d7da; color: #842029; }

.ticket-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: 1px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* Ticket público */
.ticket-header, .ticket-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}
.ticket-badges { display: flex; gap: 8px; }
.ticket-meta { margin: 16px 0; font-size: 14px; }
.ticket-meta div { margin-bottom: 4px; }
.ticket-original-message, .message-body {
    background: #f8f9fb;
    border-radius: 6px;
    padding: 12px 16px;
    white-space: pre-wrap;
}
.ticket-conversation { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.message { border-radius: 6px; padding: 4px; }
.message-author { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.message-date { font-weight: 400; color: var(--color-text-muted); margin-left: 8px; }
.message-client .message-body { background: #eef2ff; }
.message-agent .message-body { background: #f0fdf4; }
.message-private .message-body { background: #fff8e1; border: 1px dashed #e0b400; }
.message-private .message-author { color: #a26900; }

.empty-state { color: var(--color-text-muted); font-style: italic; padding: 12px 0; }

/* Base de Conhecimento */
.kb-hero { text-align: center; margin-bottom: 32px; }
.kb-hero-cta { margin-top: 20px; font-size: 14px; color: var(--color-text-muted); }
.btn-open-ticket { margin-left: 8px; }
.kb-search-form { display: flex; gap: 8px; max-width: 480px; margin: 16px auto 0; }
.kb-search-form input { flex: 1; }
.kb-categories { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.kb-category-card {
    flex: 1 1 200px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    font-weight: 600;
    color: var(--color-text);
}
.kb-category-card:hover { border-color: var(--color-accent); text-decoration: none; }
.kb-columns { display: flex; gap: 24px; flex-wrap: wrap; }
.kb-list-section { flex: 1; min-width: 260px; }
.kb-article-list { list-style: none; padding: 0; }
.kb-article-list li { padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.article-summary { color: var(--color-text-muted); font-size: 13px; margin: 4px 0 0; }
.breadcrumbs { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; }
.kb-article { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; }
.article-meta { color: var(--color-text-muted); font-size: 13px; margin-bottom: 20px; }
.article-cover { max-width: 100%; border-radius: 6px; margin-bottom: 20px; }
.article-content { line-height: 1.7; }
.article-content img { max-width: 100%; }
.kb-related { margin-top: 24px; }

/* Responsividade */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .main-nav a { margin-left: 0; margin-right: 12px; }
    .form-row { flex-direction: column; }
    .brand-logo { width: 104px; }
}
