/* ============================================
   SmartDesk AI — Custom Styles
   Mesa de Ayuda Inteligente
   ============================================ */

:root {
    --sd-primary: #DC2626;
    --sd-primary-light: rgba(220, 38, 38, 0.08);
    --sd-primary-lighter: rgba(220, 38, 38, 0.04);
    --sd-success: #22c55e;
    --sd-warning: #f59e0b;
    --sd-info: #3b82f6;
    --sd-gray: #6b7280;
    --sd-dark: #1f2937;
    --sd-light-bg: #f9fafb;
    --sd-border: #e5e7eb;
}

/* ── Sidebar Summary ── */
.sidebar-summary {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sd-border);
}

.sidebar-summary .summary-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.sidebar-summary .summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0;
}

.sidebar-summary .summary-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.sidebar-summary .summary-dot.dot-red {
    background: var(--sd-primary);
}

.sidebar-summary .summary-dot.dot-amber {
    background: var(--sd-warning);
}

.sidebar-summary .summary-dot.dot-green {
    background: var(--sd-success);
}

.sidebar-summary .summary-dot.dot-blue {
    background: var(--sd-info);
}

.sidebar-summary .summary-dot.dot-gray {
    background: var(--sd-gray);
}

.sidebar-summary .summary-label {
    font-size: 0.8125rem;
    color: #4b5563;
}

.sidebar-summary .summary-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sd-dark);
}

/* ── Sidebar User Profile ── */
.sidebar-user {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sd-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sd-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sd-primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-user .user-info .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sd-dark);
    line-height: 1.2;
}

.sidebar-user .user-info .user-email {
    font-size: 0.7rem;
    color: #9ca3af;
    line-height: 1.3;
}

/* ── Status Pills / Badges ── */
.badge-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35em 0.75em;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    white-space: nowrap;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.badge-activo {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.badge-activo::before {
    background: #dc2626;
}

.badge-pendiente {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-pendiente::before {
    background: #d97706;
}

.badge-resuelto {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.badge-resuelto::before {
    background: #16a34a;
}

.badge-cerrado {
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
}

.badge-cerrado::before {
    background: #6b7280;
}

.badge-cancelado {
    background: rgba(31, 41, 55, 0.1);
    color: #1f2937;
}

.badge-cancelado::before {
    background: #374151;
}

.badge-reabierto {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.badge-reabierto::before {
    background: #2563eb;
}

.badge-registrado {
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
}

.badge-registrado::before {
    background: #0891b2;
}

/* ── KPI Cards ── */
.kpi-card {
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.kpi-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sd-dark);
    line-height: 1;
}

.kpi-card .kpi-label {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ── Chat Interface ── */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--sd-border);
    background: white;
    border-radius: 0.5rem 0.5rem 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header .chat-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header .chat-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sd-success);
}

.chat-header .chat-badges {
    display: flex;
    gap: 0.5rem;
}

.chat-header .chat-badge {
    font-size: 0.7rem;
    padding: 0.25em 0.6em;
    background: var(--sd-light-bg);
    color: #6b7280;
    border-radius: 4px;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--sd-light-bg);
}

.chat-message {
    display: flex;
    margin-bottom: 1rem;
    gap: 0.75rem;
    max-width: 80%;
}

.chat-message.msg-bot {
    align-self: flex-start;
}

.chat-message.msg-user {
    align-self: flex-end;
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-message .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-message.msg-bot .msg-avatar {
    background: var(--sd-primary-light);
    color: var(--sd-primary);
}

.chat-message.msg-user .msg-avatar {
    background: #e5e7eb;
    color: #4b5563;
}

.chat-message .msg-bubble {
    padding: 0.875rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.chat-message.msg-bot .msg-bubble {
    background: white;
    color: #374151;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-message.msg-user .msg-bubble {
    background: var(--sd-primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.quick-replies {
    padding: 0.75rem 1.5rem;
    background: var(--sd-light-bg);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-top: 1px solid var(--sd-border);
}

.quick-reply-btn {
    padding: 0.45em 1em;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: white;
    color: #374151;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    border-color: var(--sd-primary);
    color: var(--sd-primary);
    background: var(--sd-primary-lighter);
}

.chat-input-bar {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--sd-border);
    background: white;
    border-radius: 0 0 0.5rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-input-bar .chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #374151;
    background: transparent;
}

.chat-input-bar .chat-input::placeholder {
    color: #9ca3af;
}

.chat-input-bar .btn-attach {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.15s;
}

.chat-input-bar .btn-attach:hover {
    color: #6b7280;
}

.chat-input-bar .btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sd-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.chat-input-bar .btn-send:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.875rem 1rem;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ── Ticket Table ── */
.tickets-table {
    border-collapse: separate;
    border-spacing: 0;
}

.tickets-table thead th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    border-bottom: 1px solid var(--sd-border);
    padding: 0.875rem 1.25rem;
    white-space: nowrap;
}

.tickets-table tbody td {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.tickets-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.tickets-table tbody tr:hover {
    background: var(--sd-primary-lighter);
}

.tickets-table .ticket-folio {
    font-weight: 600;
    color: var(--sd-dark);
    font-size: 0.8125rem;
}

/* ── Lifecycle Stepper ── */
.lifecycle-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0;
    position: relative;
}

.lifecycle-stepper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.lifecycle-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    position: relative;
}

.lifecycle-step .step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.lifecycle-step.step-completed .step-circle {
    background: var(--sd-success);
    border-color: var(--sd-success);
    color: white;
}

.lifecycle-step.step-current .step-circle {
    background: var(--sd-primary);
    border-color: var(--sd-primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

.lifecycle-step .step-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: #9ca3af;
    text-align: center;
    max-width: 70px;
}

.lifecycle-step.step-completed .step-label,
.lifecycle-step.step-current .step-label {
    color: var(--sd-dark);
    font-weight: 600;
}

/* ── Activity Timeline ── */
.activity-timeline {
    padding: 0;
    margin: 0;
    list-style: none;
}

.activity-timeline .timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid #e5e7eb;
    margin-left: 0.5rem;
}

.activity-timeline .timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.activity-timeline .timeline-dot {
    position: absolute;
    left: -6px;
    top: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sd-primary);
    border: 2px solid white;
}

.activity-timeline .timeline-dot.dot-success {
    background: var(--sd-success);
}

.activity-timeline .timeline-dot.dot-warning {
    background: var(--sd-warning);
}

.activity-timeline .timeline-dot.dot-info {
    background: var(--sd-info);
}

.activity-timeline .timeline-dot.dot-gray {
    background: #9ca3af;
}

.activity-timeline .timeline-content {
    font-size: 0.8125rem;
    color: #374151;
}

.activity-timeline .timeline-content strong {
    font-weight: 600;
}

.activity-timeline .timeline-time {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* ── Notification Cards ── */
.notification-card {
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: all 0.15s;
    background: white;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.notification-card:hover {
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.notification-card.notification-unread {
    background: rgba(220, 38, 38, 0.02);
    border-color: rgba(220, 38, 38, 0.12);
}

.notification-card .notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sd-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sd-primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notification-card .notif-body {
    flex: 1;
}

.notification-card .notif-folio {
    font-weight: 700;
    color: var(--sd-primary);
    font-size: 0.875rem;
}

.notification-card .notif-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sd-primary);
    display: inline-block;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.notification-card .notif-text {
    font-size: 0.8125rem;
    color: #374151;
    margin-top: 0.15rem;
}

.notification-card .notif-time {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.notification-card .notif-action {
    font-size: 0.75rem;
    color: #9ca3af;
    text-decoration: none;
    white-space: nowrap;
    align-self: center;
    transition: color 0.15s;
}

.notification-card .notif-action:hover {
    color: var(--sd-primary);
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header .page-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--sd-dark);
    margin-bottom: 0.15rem;
}

.page-header .page-subtitle {
    font-size: 0.8125rem;
    color: #9ca3af;
}

/* ── Search Bar ── */
.search-tickets {
    position: relative;
    margin-bottom: 1.25rem;
}

.search-tickets .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.1rem;
}

.search-tickets input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--sd-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    color: #374151;
    transition: border-color 0.15s;
}

.search-tickets input:focus {
    outline: none;
    border-color: var(--sd-primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.search-tickets input::placeholder {
    color: #9ca3af;
}

/* ── Ticket Detail Fields ── */
.detail-field {
    margin-bottom: 1rem;
}

.detail-field .field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.detail-field .field-value {
    font-size: 0.875rem;
    color: var(--sd-dark);
    font-weight: 500;
}

/* ── Form Styles ── */
.smartdesk-form .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.smartdesk-form .form-select,
.smartdesk-form .form-control {
    border-radius: 0.5rem;
    border-color: var(--sd-border);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
}

.smartdesk-form .form-select:focus,
.smartdesk-form .form-control:focus {
    border-color: var(--sd-primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

/* ── Misc Utilities ── */
.text-primary-sd {
    color: var(--sd-primary) !important;
}

.bg-primary-sd {
    background-color: var(--sd-primary) !important;
}

.bg-primary-sd-light {
    background-color: var(--sd-primary-light) !important;
}

/* Hide buy-now button from template */
.buy-now {
    display: none !important;
}

/* Notification badge in sidebar */
.menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--sd-primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0 5px;
    margin-left: auto;
}

/* Active menu indicator bar */
.menu-inner>.menu-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--sd-primary);
    border-radius: 3px 0 0 3px;
}