/**
 * IT Ticketing - History Ticket Modal, DataTables & Detail Styles
 * Module: IT / IT Ticketing
 */

/* ==========================================================================
   MODAL BASE & CONTROLS (STANDALONE COMPATIBILITY)
   ========================================================================== */
/* Reset aturan modal DaisyUI pada modal Ticketing */
.modal.it-ticket-modal {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: none;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    outline: 0;
    text-align: left;
    transform: none;
}

.it-ticket-modal *,
.it-ticket-modal *::before,
.it-ticket-modal *::after {
    box-sizing: border-box;
}

.modal.it-ticket-modal.fade {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.it-ticket-modal.show {
    opacity: 1;
}

.it-ticket-modal .modal-dialog {
    position: relative;
    display: flex;
    align-items: center;
    width: auto;
    max-width: 560px;
    min-height: calc(100% - 48px);
    margin: 24px auto;
    padding: 0 16px;
    pointer-events: none;
}

.it-ticket-modal .modal-dialog.modal-lg {
    max-width: 900px;
}

.it-ticket-modal .modal-dialog.modal-xl {
    max-width: 1140px;
}

.it-ticket-modal.fade .modal-dialog {
    transform: translateY(-24px);
    transition: transform 0.3s ease-out;
}

.it-ticket-modal.show .modal-dialog {
    transform: none;
}

.it-ticket-modal .modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    pointer-events: auto;
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.26);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
}

.it-ticket-modal .modal-content>form {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    min-height: 0;
}

.it-ticket-modal .modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #dbeafe;
    background: linear-gradient(135deg, #f8fbff 0%, #eef2ff 100%);
}

.it-ticket-modal .modal-title {
    margin: 0;
    color: #0f172a;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
}

.it-ticket-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px;
    line-height: 1.7;
    overflow-y: auto;
    overflow-wrap: anywhere;
    overscroll-behavior: contain;
}

.it-ticket-modal .modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.it-ticket-modal .it-ticket-secondary-button {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.it-ticket-modal .it-ticket-secondary-button:hover:not(:disabled) {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-1px);
}

.it-ticket-modal .it-ticket-submit-button {
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 58%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.it-ticket-modal .it-ticket-submit-button:hover:not(:disabled) {
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.36);
    transform: translateY(-1px);
}

.it-ticket-modal .modal-footer>.btn:focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.42);
    outline-offset: 3px;
}

.it-ticket-modal .modal-footer>.btn:disabled {
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.it-ticket-modal .it-ticket-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.it-ticket-modal .it-ticket-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.it-ticket-modal .it-ticket-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

/* Backdrop div yang dibuat oleh Bootstrap */
body.it-ticketing-landing>div.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: block;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    visibility: visible;
    pointer-events: auto;
}

body.it-ticketing-landing>div.modal-backdrop.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

body.it-ticketing-landing>div.modal-backdrop.show {
    opacity: 0.5;
}

body.it-ticketing-landing.modal-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {

    .modal.it-ticket-modal.fade,
    .it-ticket-modal.fade .modal-dialog,
    body.it-ticketing-landing>div.modal-backdrop.fade {
        transition: none;
    }
}

/* ==========================================================================
   HISTORY IT TICKETING MODAL, DETAIL & DATATABLES STYLES
   ========================================================================== */
/* Seluruh aturan History dibatasi pada modal Ticketing ini. */
#ticketHistoryModal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
}

#ticketHistoryModal .modal-header,
#ticketHistoryModal .modal-footer {
    flex: 0 0 auto;
}

#ticketHistoryModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.it-ticket-history-intro {
    margin: 0 0 18px;
    color: #64748b;
    font-size: 0.92rem;
}

.it-ticket-history-state {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
    color: #475569;
    text-align: center;
}

.it-ticket-history-state[hidden],
.it-ticket-history-pagination[hidden],
.it-ticket-history-table-wrap[hidden],
.it-ticket-detail-view[hidden],
.it-ticket-history-view[hidden],
#ticketDetailContent[hidden] {
    display: none !important;
}

.it-ticket-history-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 999px;
    animation: it-ticket-history-spin 0.75s linear infinite;
}

@keyframes it-ticket-history-spin {
    to {
        transform: rotate(360deg);
    }
}

.it-ticket-history-toolbar,
.it-ticket-history-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.it-ticket-history-toolbar {
    justify-content: flex-start;
    margin-bottom: 14px;
}

.it-ticket-history-search {
    position: relative;
    display: block;
    flex: 1 1 320px;
    width: 100%;
    max-width: 460px;
    min-width: 0;
}

.it-ticket-history-scope {
    position: relative;
}

.it-ticket-history-filter {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #b8c4d6;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.it-ticket-history-filter:hover,
.it-ticket-history-filter:focus-visible {
    border-color: #435ebe;
}

.it-ticket-history-scope .dropdown-toggle::after {
    display: inline-block;
    margin-left: 8px;
    vertical-align: 3px;
    content: "";
    border-top: 5px solid currentColor;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
}

.it-ticket-history-scope .dropdown-menu {
    position: absolute;
    z-index: 1060;
    top: 100%;
    right: 0;
    display: none;
    min-width: 220px;
    padding: 6px;
    margin: 4px 0 0;
    list-style: none;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.it-ticket-history-scope .dropdown-menu.show {
    display: block;
}

.it-ticket-history-scope .dropdown-item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    color: #334155;
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    white-space: nowrap;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.it-ticket-history-scope .dropdown-item:hover,
.it-ticket-history-scope .dropdown-item:focus-visible {
    background: #f1f5f9;
}

.it-ticket-history-scope .dropdown-item.active {
    color: #1d4ed8;
    background: #eff6ff;
    font-weight: 700;
}

.it-ticket-history-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 2;
    color: #6c757d;
    pointer-events: none;
    transform: translateY(-50%);
}

#ticketHistoryModal .it-ticket-history-search .form-control {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 14px 9px 42px;
    border: 1px solid #b8c4d6 !important;
    border-radius: 0.35rem;
    outline: 0;
    background-color: #fff !important;
    background-image: none !important;
    color: #607080;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    appearance: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#ticketHistoryModal .it-ticket-history-search .form-control::placeholder {
    color: #98a2b3;
    opacity: 1;
}

#ticketHistoryModal .it-ticket-history-search .form-control:hover {
    border-color: #8797ad !important;
}

#ticketHistoryModal .it-ticket-history-search .form-control:focus {
    border-color: #435ebe !important;
    box-shadow: 0 0 0 0.2rem rgba(67, 94, 190, 0.16);
}

#ticketHistoryModal .it-ticket-history-search:focus-within .it-ticket-history-search-icon {
    color: #435ebe;
}

#ticketHistoryModal .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.it-ticket-history-result-summary {
    margin-left: auto;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
}

.it-ticket-history-table-wrap {
    display: block;
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    -webkit-overflow-scrolling: touch;
}

.it-ticket-history-table {
    display: table;
    width: 100% !important;
    min-width: 940px;
    margin: 0 !important;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
    color: #334155;
}

.it-ticket-history-table thead th {
    padding: 12px 14px;
    border-bottom: 2px solid #e3e6f0;
    background: #f8f9fa;
    color: #4e73df;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.it-ticket-history-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.84rem;
    vertical-align: middle;
}

.it-ticket-history-table thead th:first-child,
.it-ticket-history-table tbody td:first-child {
    width: 1%;
    padding-left: 16px;
    padding-right: 16px;
    text-align: center;
    white-space: nowrap;
}

.it-ticket-history-table thead th:last-child,
.it-ticket-history-table tbody td:last-child {
    padding-right: 16px;
}

.it-ticket-history-table tbody tr:last-child td {
    border-bottom: 0;
}

.it-ticket-history-table tbody tr:hover td {
    background: #f8fbff;
}

.it-ticket-history-code {
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.it-ticket-history-title {
    display: block;
    max-width: 270px;
    margin: 0;
    color: #0f172a;
    font-size: 0.86rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.it-ticket-detail-field {
    min-width: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    line-height: 1.5;
}

.it-ticket-detail-label {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: capitalize;
    white-space: nowrap;
    flex-shrink: 0;
}

.it-ticket-history-date {
    white-space: nowrap;
}

.it-ticket-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap !important;
}

.it-ticket-status--onprogress,
.it-ticket-status--proses,
.it-ticket-status--rusak {
    background: #fef3c7;
    color: #92400e;
}

.it-ticket-status--selesai {
    background: #dcfce7;
    color: #166534;
}

.it-ticket-status--unknown {
    background: #e2e8f0;
    color: #475569;
}

.it-ticket-feedback-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap !important;
}

.it-ticket-feedback-pill--missing {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.it-ticket-feedback-pill--filled {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.it-ticket-history-page-summary {
    color: #475569;
    font-size: 0.86rem;
    font-weight: 700;
    text-align: center;
}

.it-ticket-history-pagination {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.it-ticket-history-detail-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #435ebe;
    border-radius: 0.35rem;
    background: #435ebe;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(67, 94, 190, 0.2);
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.it-ticket-history-detail-button:hover:not(:disabled) {
    border-color: #364b98;
    background: #364b98;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 9px rgba(67, 94, 190, 0.25);
}

.it-ticket-history-detail-button:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(67, 94, 190, 0.22);
}

.it-ticket-history-detail-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.it-ticket-detail-heading {
    margin: 16px 0;
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.it-ticket-detail-heading-copy {
    flex: 1 1 240px;
    min-width: 0;
}

.it-ticket-detail-heading-copy .it-ticket-history-code {
    margin-bottom: 4px;
    display: inline-block;
    font-weight: 700;
    color: #2563eb;
    font-size: 0.85rem;
}

.it-ticket-detail-heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.it-ticket-detail-section {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
}

.it-ticket-detail-section h4 {
    margin: 0 0 14px;
    color: #0f172a;
    font-size: 0.98rem;
    font-weight: 800;
}

.it-ticket-detail-section textarea {
    width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}

.it-ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.it-ticket-detail-field--full {
    grid-column: 1 / -1;
}

.it-ticket-detail-value {
    color: #0f172a;
    font-size: 0.9rem;
    font-weight: 650;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.it-ticket-detail-note {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 0.8rem;
}

.it-ticket-detail-heading-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.it-ticket-detail-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.it-ticket-detail-completed-badge i {
    font-size: 0.85rem;
}

.it-ticket-signature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.it-ticket-signature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.it-ticket-signature-role {
    font-size: 0.78rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    text-align: center;
}

.it-ticket-signature-box {
    height: 76px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    margin-bottom: 8px;
    padding: 6px;
    overflow: hidden;
}

.it-ticket-signature-box img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.it-ticket-signature-placeholder {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 500;
    text-align: center;
}

.it-ticket-signature-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    overflow-wrap: anywhere;
}

.it-ticket-detail-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.it-ticket-detail-photo,
.it-ticket-detail-photo-missing {
    display: flex;
    min-height: 135px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.82rem;
    text-align: center;
}

.it-ticket-detail-photo img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.it-ticket-detail-photo:hover img {
    transform: scale(1.025);
}

@media (max-width: 768px) {
    .it-ticket-detail-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .it-ticket-detail-heading-copy {
        width: 100%;
        flex: 1 1 100%;
    }

    .it-ticket-detail-heading-meta {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        padding-top: 10px;
        border-top: 1px solid #dbeafe;
    }
}

@media (max-width: 575.98px) {
    #ticketHistoryModal .modal-content {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }

    .it-ticket-detail-grid,
    .it-ticket-signature-grid {
        grid-template-columns: 1fr;
    }

    .it-ticket-detail-heading {
        padding: 14px;
    }

    .it-ticket-detail-heading h3 {
        font-size: 1.05rem;
    }

    .it-ticket-detail-completed-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .it-ticket-history-pagination .btn {
        flex: 1 1 auto;
    }

    .it-ticket-history-toolbar {
        align-items: stretch;
    }

    .it-ticket-history-search {
        flex-basis: 100%;
        max-width: none;
    }

    .it-ticket-history-scope {
        width: 100%;
    }

    .it-ticket-history-scope .dropdown-menu {
        min-width: 100%;
    }

    .it-ticket-history-filter {
        width: 100%;
    }

    .it-ticket-history-result-summary {
        width: 100%;
    }

    .it-ticket-history-page-summary {
        flex: 1 0 100%;
        order: -1;
    }
}

/* DataTables Integration Helpers */
.dataTables_filter,
.dataTables_info,
.dataTables_paginate {
    display: none !important;
}
.it-ticket-history-table-wrap .dataTables_wrapper {
    width: 100%;
}
.it-ticket-history-table-wrap .dataTables_processing {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
}
