/* PORTAL TI - COMPONENTS / COMMON UI */

/* =========================================================
   PAGE HEADER / HERO
========================================================= */

.ti-page-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #2563eb 100%);
    color: #ffffff;
    padding: 28px 32px;
    border-radius: var(--ti-radius);
    box-shadow: var(--ti-shadow);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

    .ti-page-header::after {
        content: "";
        position: absolute;
        width: 260px;
        height: 260px;
        border-radius: 50%;
        background: rgba(255,255,255,0.08);
        right: -80px;
        top: -100px;
    }

.ti-page-title {
    font-size: 26px;
    font-weight: 900;
    margin: 0;
    color: #ffffff;
}

.ti-page-subtitle {
    margin-top: 6px;
    color: rgba(255,255,255,0.84);
    font-size: 14px;
}

.ti-seg-hero,
.ti-bti-hero,
.ti-request-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

    .ti-seg-hero > div,
    .ti-bti-hero > div,
    .ti-request-header > div {
        z-index: 1;
    }

.ti-seg-hero-icon,
.ti-bti-hero-icon,
.ti-request-hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(255,255,255,.12);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1;
}

/* =========================================================
   CARDS / FORMS / BUTTONS
========================================================= */

.ti-card,
.ti-table-wrapper {
    background: var(--ti-card);
    border: 1px solid var(--ti-border);
    border-radius: var(--ti-radius);
    box-shadow: var(--ti-shadow-soft);
    overflow: hidden;
}

.ti-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--ti-border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.ti-card-title {
    font-size: 17px;
    font-weight: 900;
    margin: 0 0 18px 0;
    color: var(--ti-primary);
}

.ti-card-subtitle {
    margin-top: 4px;
    color: var(--ti-muted);
    font-size: 13px;
}

.ti-card-body {
    padding: 22px;
}

.ti-form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 18px;
}

.ti-col-12 {
    grid-column: span 12;
}

.ti-col-6 {
    grid-column: span 6;
}

.ti-col-4 {
    grid-column: span 4;
}

.ti-col-3 {
    grid-column: span 3;
}

label,
.form-label {
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}

.form-control,
.form-select,
select,
input,
textarea {
    border-radius: var(--ti-radius-sm) !important;
    border: 1px solid #d1d5db !important;
    padding: 10px 12px !important;
    min-height: 42px;
    transition: all 0.2s ease;
}

    .form-control:focus,
    .form-select:focus,
    select:focus,
    input:focus,
    textarea:focus {
        border-color: var(--ti-accent) !important;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12) !important;
    }

textarea {
    resize: vertical;
}

.btn {
    border-radius: 999px !important;
    font-weight: 700;
    padding: 10px 18px;
    transition: all 0.2s ease;
}

.btn-primary,
.ti-btn-primary {
    background: var(--ti-accent) !important;
    border-color: var(--ti-accent) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}

    .btn-primary:hover,
    .ti-btn-primary:hover {
        background: var(--ti-accent-hover) !important;
        transform: translateY(-1px);
    }

.ti-btn-secondary {
    background: #ffffff;
    color: var(--ti-primary);
    border: 1px solid var(--ti-border);
}

    .ti-btn-secondary:hover {
        background: #f8fafc;
    }

.ti-btn-with-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ti-required::after {
    content: " *";
    color: var(--ti-danger);
    font-weight: 900;
}

/* =========================================================
   BADGES / SLA / ACTION ICONS
========================================================= */

.ti-badge,
.ti-sla-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ti-badge-registrado {
    background: #e0f2fe;
    color: #0369a1;
}

.ti-badge-revision {
    background: #fef3c7;
    color: #92400e;
}

.ti-badge-proceso {
    background: #dbeafe;
    color: #1d4ed8;
}

.ti-badge-validacion {
    background: #ede9fe;
    color: #6d28d9;
}

.ti-badge-cerrado {
    background: #dcfce7;
    color: #166534;
}

.ti-badge-rechazado {
    background: #fee2e2;
    color: #991b1b;
}

.ti-badge-postergado {
    background: #f3f4f6;
    color: #374151;
}

.ti-sla-badge {
    background: #e2e8f0;
    color: #334155;
}

    .ti-sla-badge.success {
        background: #dcfce7;
        color: #166534;
    }

    .ti-sla-badge.warning {
        background: #fef3c7;
        color: #92400e;
    }

    .ti-sla-badge.danger {
        background: #fee2e2;
        color: #991b1b;
    }

    .ti-sla-badge.neutral {
        background: #dbeafe;
        color: #1e3a8a;
    }

.ti-ticket-days {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 34px;
    height: 28px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-weight: 900;
    font-size: 12px;
}

    .ti-ticket-days.warning {
        background: #fef3c7;
        color: #92400e;
    }

    .ti-ticket-days.danger {
        background: #fee2e2;
        color: #991b1b;
    }

.ti-ticket-action-group.compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.ti-action-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 12px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 !important;
    transition: all .16s ease;
}

    .ti-action-icon i {
        font-size: 16px;
        line-height: 1;
    }

    .ti-action-icon:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 18px rgba(15, 23, 42, .10);
    }

    .ti-action-icon.primary {
        background: #eff6ff;
        border-color: #bfdbfe;
        color: #1d4ed8;
    }

    .ti-action-icon.success {
        background: #f0fdf4;
        border-color: #bbf7d0;
        color: #166534;
    }

    .ti-action-icon.primary:hover {
        background: #2563eb;
        border-color: #2563eb;
        color: #ffffff;
    }

    .ti-action-icon.success:hover {
        background: #16a34a;
        border-color: #16a34a;
        color: #ffffff;
    }

/* =========================================================
   GENERIC MODALS / COLUMN MODAL
========================================================= */

.ti-modal-pro,
.ti-column-modal {
    background: #ffffff;
    border: 0;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(15, 23, 42, .24);
}

    .ti-modal-pro .modal-header,
    .ti-column-modal-header {
        background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
        border-bottom: 1px solid #e5eaf2;
        padding: 18px 22px;
    }

        .ti-modal-pro .modal-title,
        .ti-column-modal-header .modal-title {
            color: #0f172a !important;
            font-weight: 950;
            font-size: 18px;
            margin: 0;
        }

.ti-column-modal-subtitle {
    margin-top: 5px;
    color: #64748b;
    font-size: 13px;
}

.ti-modal-pro .modal-body,
.ti-column-modal-body {
    padding: 22px;
}

.ti-modal-pro .modal-footer,
.ti-column-modal-footer {
    background: #ffffff;
    border-top: 1px solid #e5eaf2;
    padding: 16px 22px;
}

.ti-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.ti-column-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ti-column-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 800;
    color: #334155;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

    .ti-column-item:hover {
        background: #eef2ff;
        border-color: #c7d2fe;
        transform: translateY(-1px);
    }

    .ti-column-item input {
        width: 16px;
        height: 16px;
        min-height: auto !important;
        accent-color: #2563eb;
        cursor: pointer;
    }

/* =========================================================
   NOTIFICATIONS
========================================================= */

.ti-notification-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.ti-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #ffffff;
}

.ti-notification-panel {
    position: absolute;
    top: 52px;
    right: 0;
    width: 390px;
    background: #ffffff;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .20);
    z-index: 5000;
    overflow: hidden;
}

.ti-notification-header {
    padding: 16px 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

    .ti-notification-header strong {
        display: block;
        color: #0f172a;
        font-size: 15px;
    }

    .ti-notification-header small {
        color: #64748b;
        font-size: 12px;
    }

    .ti-notification-header button {
        border: 0;
        background: #eef2ff;
        color: #1d4ed8;
        font-size: 12px;
        font-weight: 900;
        padding: 7px 10px;
        border-radius: 999px;
    }

.ti-notification-list {
    max-height: 440px;
    overflow-y: auto;
}

.ti-notification-item {
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    cursor: pointer;
    transition: background .16s ease;
}

    .ti-notification-item:hover {
        background: #f8fafc;
    }

    .ti-notification-item.unread {
        background: #eff6ff;
        border-left: 4px solid #2563eb;
    }

.ti-notification-title {
    font-size: 13px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 5px;
}

.ti-notification-message {
    font-size: 12px;
    color: #475569;
    line-height: 1.45;
    max-height: 38px;
    overflow: hidden;
}

.ti-notification-meta {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
}

.ti-notification-empty {
    padding: 34px 18px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

/* =========================================================
   LOADER / TOAST / EMPTY
========================================================= */

.ti-loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.ti-loader-box {
    background: #ffffff;
    border-radius: var(--ti-radius);
    padding: 26px 32px;
    box-shadow: var(--ti-shadow);
    text-align: center;
    min-width: 220px;
}

.ti-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid var(--ti-accent);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: ti-spin .8s linear infinite;
}

@keyframes ti-spin {
    to {
        transform: rotate(360deg);
    }
}

.ti-toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ti-toast {
    min-width: 280px;
    max-width: 420px;
    background: #ffffff;
    border-left: 5px solid var(--ti-accent);
    border-radius: 12px;
    box-shadow: var(--ti-shadow);
    padding: 14px 16px;
    animation: ti-slide-in .25s ease;
}

.ti-toast-title {
    font-weight: 900;
    margin-bottom: 4px;
}

.ti-toast-message {
    color: var(--ti-muted);
    font-size: 13px;
}

.ti-toast.success {
    border-left-color: var(--ti-success);
}

.ti-toast.warning {
    border-left-color: var(--ti-warning);
}

.ti-toast.error {
    border-left-color: var(--ti-danger);
}

.ti-toast.info {
    border-left-color: var(--ti-info);
}

@keyframes ti-slide-in {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ti-empty {
    text-align: center;
    padding: 34px 18px;
    color: var(--ti-muted);
}

.ti-empty-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--ti-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

/* =========================================================
   QUILL OUTLOOK-LIKE EDITOR / RENDER
========================================================= */

.ti-quill-wrapper {
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .035);
}

    .ti-quill-wrapper .ql-toolbar.ql-snow {
        border: 0;
        border-bottom: 1px solid #e5eaf2;
        background: #f8fafc;
        padding: 10px 12px;
    }

    .ti-quill-wrapper .ql-container.ql-snow {
        border: 0;
        font-family: Inter, "Segoe UI", Arial, sans-serif;
        font-size: 14px;
        color: #1e293b;
    }

    .ti-quill-wrapper .ql-editor {
        min-height: 220px;
        line-height: 1.55;
        padding: 16px;
    }

        .ti-quill-wrapper .ql-editor.ql-blank::before {
            color: #64748b;
            font-style: normal;
        }

    .ti-quill-wrapper .ql-toolbar button {
        border-radius: 8px;
    }

        .ti-quill-wrapper .ql-toolbar button:hover,
        .ti-quill-wrapper .ql-toolbar button.ql-active,
        .ti-quill-wrapper .ql-toolbar .ql-picker-label:hover,
        .ti-quill-wrapper .ql-toolbar .ql-picker-label.ql-active {
            color: #2563eb;
        }

    .ti-quill-wrapper.ti-quill-disabled {
        opacity: .75;
        background: #f8fafc;
    }

        .ti-quill-wrapper.ti-quill-disabled .ql-toolbar {
            pointer-events: none;
            opacity: .65;
        }

        .ti-quill-wrapper.ti-quill-disabled .ql-editor {
            background: #f8fafc;
        }

.ti-ticket-rich-box p,
.ti-comment-body p,
.ti-timeline-comment p,
#lblDescripcionDetalle p,
#lblSegDescripcion p,
#lblSegObsVisible p {
    margin: 0 0 8px 0;
}

.ti-ticket-rich-box ul,
.ti-ticket-rich-box ol,
.ti-comment-body ul,
.ti-comment-body ol,
.ti-timeline-comment ul,
.ti-timeline-comment ol,
#lblDescripcionDetalle ul,
#lblDescripcionDetalle ol,
#lblSegDescripcion ul,
#lblSegDescripcion ol {
    margin-top: 6px;
    margin-bottom: 8px;
    padding-left: 22px;
}

.ql-align-center {
    text-align: center;
}

.ql-align-right {
    text-align: right;
}

.ql-align-justify {
    text-align: justify;
}

.ql-indent-1 {
    padding-left: 3em;
}

.ql-indent-2 {
    padding-left: 6em;
}

.ql-indent-3 {
    padding-left: 9em;
}

.ql-indent-4 {
    padding-left: 12em;
}

.ql-indent-5 {
    padding-left: 15em;
}

.ql-indent-6 {
    padding-left: 18em;
}

.ql-indent-7 {
    padding-left: 21em;
}

.ql-indent-8 {
    padding-left: 24em;
}

/* =========================================================
   PORTAL TI - HARDENING FINAL GLOBAL
   Mantener este bloque al final de portal-ti.css.
   El detalle usa ticket-detalle-pro.css.
========================================================= */

/* Badges globales consistentes para Seguimiento, Bandeja TI y Detalle */
.ti-badge,
.ti-sla-badge {
    min-height: 26px;
    line-height: 1 !important;
    border: 1px solid transparent;
}

.ti-badge-registrado {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border-color: #bae6fd !important;
}

.ti-badge-revision {
    background: #fef3c7 !important;
    color: #92400e !important;
    border-color: #fde68a !important;
}

.ti-badge-proceso {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border-color: #bfdbfe !important;
}

.ti-badge-validacion {
    background: #ede9fe !important;
    color: #6d28d9 !important;
    border-color: #ddd6fe !important;
}

.ti-badge-cerrado {
    background: #dcfce7 !important;
    color: #166534 !important;
    border-color: #bbf7d0 !important;
}

.ti-badge-rechazado {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border-color: #fecaca !important;
}

.ti-badge-postergado {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border-color: #e5e7eb !important;
}

.ti-sla-badge.success {
    background: #dcfce7 !important;
    color: #166534 !important;
    border-color: #bbf7d0 !important;
}

.ti-sla-badge.warning {
    background: #fef3c7 !important;
    color: #92400e !important;
    border-color: #fde68a !important;
}

.ti-sla-badge.danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border-color: #fecaca !important;
}

.ti-sla-badge.neutral,
.ti-sla-badge {
    background: #e2e8f0 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

/* Evita que estilos globales de .btn deformen botones de pantallas especializadas */
.ti-det-page .btn,
.ti-det-page button {
    max-width: none;
}

/* Mobile hardening global */
@media (max-width: 768px) {
    html,
    body {
        height: auto !important;
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .ti-app-shell,
    .ti-main,
    .ti-content {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }

    .ti-topbar,
    .ti-topbar-pro {
        position: sticky;
        top: 0;
        z-index: 900;
    }

    .ti-content {
        padding: 14px !important;
    }
}

/* =========================================================
   PORTAL TI - IMÁGENES PEGADAS EN EDITOR / RENDER
   Pegar al final de portal-ti.css y/o ticket-detalle-pro.css
========================================================= */
.ti-quill-wrapper .ql-editor img,
.ti-ticket-content-render img,
.ti-det-rich img,
.ti-mail-render img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 10px 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.ti-quill-wrapper .ql-editor img {
    cursor: default;
}

.ti-ticket-content-render a,
.ti-det-rich a,
.ti-mail-render a {
    color: #2563eb;
    text-decoration: underline;
    word-break: break-word;
}

/* ============================================================
   PORTAL TI - SWEETALERT CORPORATIVO
   ============================================================ */

.ti-swal-popup {
    border-radius: 22px !important;
    padding: 26px 28px !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22) !important;
    font-family: inherit !important;
}

.ti-swal-title {
    color: #0f172a !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

.ti-swal-text {
    color: #475569 !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
}

.ti-swal-confirm,
.ti-swal-cancel {
    border: 0 !important;
    border-radius: 14px !important;
    padding: 11px 18px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    min-width: 130px !important;
}

.ti-swal-confirm {
    background: #2563eb !important;
    color: #ffffff !important;
}

    .ti-swal-confirm:hover {
        background: #1d4ed8 !important;
    }

.ti-swal-cancel {
    background: #f1f5f9 !important;
    color: #334155 !important;
}

    .ti-swal-cancel:hover {
        background: #e2e8f0 !important;
    }

/* ============================================================
   PORTAL TI - SWEETALERT TOAST
   ============================================================ */

.ti-swal-toast {
    border-radius: 16px !important;
    padding: 12px 16px !important;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18) !important;
    font-family: inherit !important;
}

.ti-swal-toast-title {
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 800 !important;
}

.ti-swal-toast-text {
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}
