/* ===================================================
   Zona de Tickets del Cliente – Multas Tacógrafo
   =================================================== */

:root {
    --maha-dark:       #0a1628;
    --maha-navy:       #0d2147;
    --maha-blue:       #1565c0;
    --maha-blue-light: #1e88e5;
    --maha-accent:     #00c853;
    --maha-bg:         #f0f4f8;
    --maha-card:       #ffffff;
    --maha-text:       #212529;
    --maha-muted:      #6c757d;
    --maha-border:     #dee2e6;
    --maha-radius:     12px;
    --maha-shadow:     0 4px 24px rgba(10,22,40,.08);
    --maha-shadow-hover:0 8px 32px rgba(10,22,40,.14);
}

html, body { height: 100%; margin: 0; padding: 0; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', 'Roboto', sans-serif;
    background: var(--maha-bg);
    color: var(--maha-text);
}

main { flex: 1; }

/* ---------- navbar ---------- */
.ticket-navbar {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    padding: .5rem 0;
}
.ticket-navbar .navbar-brand {
    color: var(--maha-navy) !important;
    font-weight: 700;
    font-size: 1.05rem;
}

/* ---------- login card ---------- */
.login-hero {
    background: linear-gradient(135deg, var(--maha-dark) 0%, var(--maha-navy) 100%);
    padding: 3rem 0;
    color: #fff;
    text-align: center;
    border-radius: var(--maha-radius);
    margin-bottom: 2rem;
}
.login-card {
    background: var(--maha-card);
    border-radius: var(--maha-radius);
    box-shadow: var(--maha-shadow);
    padding: 2rem;
    border: 1px solid var(--maha-border);
    max-width: 480px;
    margin: 0 auto;
}

/* ---------- ticket list ---------- */
.ticket-list-item {
    background: var(--maha-card);
    border: 1px solid var(--maha-border);
    border-radius: var(--maha-radius);
    padding: 1.25rem;
    margin-bottom: .75rem;
    transition: transform .2s, box-shadow .2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.ticket-list-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--maha-shadow-hover);
    color: inherit;
}
.ticket-list-item .ticket-ref {
    font-family: monospace;
    font-weight: 700;
    color: var(--maha-blue);
    font-size: .85rem;
}
.ticket-list-item .ticket-subject {
    font-weight: 600;
    font-size: 1rem;
    color: var(--maha-navy);
    margin: 4px 0;
}
.ticket-list-item .ticket-meta {
    font-size: .8rem;
    color: var(--maha-muted);
}

/* ---------- ticket view (chat) ---------- */
.ticket-header-card {
    background: var(--maha-card);
    border: 1px solid var(--maha-border);
    border-radius: var(--maha-radius);
    box-shadow: var(--maha-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.ticket-header-top {
    background: linear-gradient(135deg, var(--maha-dark), var(--maha-navy));
    color: #fff;
    padding: 1.25rem 1.5rem;
}
.ticket-header-body {
    padding: 1rem 1.5rem;
}

.message-list {
    margin-bottom: 1.5rem;
}
.message-bubble {
    width: 80%;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--maha-radius);
    position: relative;
}
.message-bubble.client {
    background: var(--maha-card);
    border: 1px solid var(--maha-border);
    margin-right: auto;
}
.message-bubble.support,
.message-bubble.admin {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #90caf9;
    margin-left: auto;
}
.message-bubble.system {
    background: #fff3cd;
    border: 1px solid #ffc107;
    margin: 0 auto 1rem auto;
    width: 100%;
    text-align: left;
    font-size: .85rem;
}
.message-bubble.internal {
    background: #fff0f0;
    border: 1px solid #f5c6cb;
    margin-left: auto;
}
.message-author {
    font-weight: 700;
    font-size: .82rem;
    margin-bottom: 4px;
}
.message-author.client-author { color: var(--maha-navy); }
.message-author.support-author { color: var(--maha-blue); }
.message-author.admin-author { color: #6f42c1; }
.message-body {
    font-size: .92rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.message-time {
    font-size: .72rem;
    color: var(--maha-muted);
    margin-top: 6px;
}
.message-attachments {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,.08);
}
.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(21,101,192,.08);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: .8rem;
    color: var(--maha-blue);
    text-decoration: none;
    margin-right: 6px;
    margin-bottom: 4px;
    transition: background .2s;
}
.attachment-link:hover {
    background: rgba(21,101,192,.15);
    color: var(--maha-navy);
}

/* ---------- reply form ---------- */
.reply-card {
    background: var(--maha-card);
    border: 1px solid var(--maha-border);
    border-radius: var(--maha-radius);
    box-shadow: var(--maha-shadow);
    padding: 1.5rem;
}
.reply-card textarea {
    border-radius: 8px;
    border: 1.5px solid var(--maha-border);
    resize: vertical;
}
.reply-card textarea:focus {
    border-color: var(--maha-blue);
    box-shadow: 0 0 0 .2rem rgba(21,101,192,.15);
}

/* ---------- status badges ---------- */
.badge-status-abierto            { background: #28a745; color: #fff; }
.badge-status-en_progreso        { background: #17a2b8; color: #fff; }
.badge-status-esperando_cliente  { background: #ffc107; color: #212529; }
.badge-status-resuelto           { background: #6c757d; color: #fff; }
.badge-status-cerrado            { background: #343a40; color: #fff; }

.badge-priority-baja    { background: #e9ecef; color: #495057; }
.badge-priority-media   { background: #fff3cd; color: #856404; }
.badge-priority-alta    { background: #f8d7da; color: #721c24; }
.badge-priority-urgente { background: #dc3545; color: #fff; }

/* ---------- buttons ---------- */
.btn-maha {
    background: linear-gradient(135deg, var(--maha-blue), var(--maha-blue-light));
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    padding: .6rem 1.5rem;
    transition: transform .2s, box-shadow .2s;
}
.btn-maha:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21,101,192,.35);
    color: #fff;
}

/* ---------- empty state ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-state i {
    font-size: 3rem;
    color: var(--maha-border);
    margin-bottom: 1rem;
}

/* ---------- footer ---------- */
.ticket-footer {
    background: var(--maha-dark);
    color: rgba(255,255,255,.7);
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
    font-size: .85rem;
}
.ticket-footer a { color: rgba(255,255,255,.9); text-decoration: none; }
.ticket-footer a:hover { color: #fff; text-decoration: underline; }
.ticket-footer .footer-brand { font-weight: 700; color: #fff; font-size: 1rem; margin-bottom: .25rem; }

/* ---------- doc summary card ---------- */
.doc-summary-card {
    background: var(--maha-card);
    border: 1px solid #c8e6c9;
    border-left: 4px solid var(--maha-accent, #00c853);
    border-radius: var(--maha-radius);
    box-shadow: var(--maha-shadow);
    margin: 1rem 0;
    overflow: hidden;
}
.doc-summary-header {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    padding: .75rem 1rem;
    font-weight: 600;
    font-size: .92rem;
    color: var(--maha-navy);
    border-bottom: 1px solid #c8e6c9;
}
.doc-summary-body {
    padding: .75rem 1rem;
}
.doc-summary-body .table th {
    font-weight: 600;
    border: none;
    padding: .35rem .5rem;
}
.doc-summary-body .table td {
    border: none;
    padding: .35rem .5rem;
    vertical-align: middle;
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
    .message-bubble { max-width: 95%; }
    .ticket-header-top { padding: 1rem; }
}
