/* ==========================================================================
   Instant Support Ticket Modal & Drawer Styles
   ========================================================================== */

#instantSupportTicketModal {
    z-index: 2147483646 !important;
}

body.modal-open .modal-backdrop {
    z-index: 2147483645 !important;
}

#instantSupportTicketModal .modal-dialog {
    z-index: 2147483646 !important;
    max-width: 760px;
    margin: 1.5rem auto;
    position: relative;
}

#instantSupportTicketModal .modal-content {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    background: #ffffff;
    position: relative;
    z-index: 2147483646 !important;
}

#instantSupportTicketModal .modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#instantSupportTicketModal .modal-header .modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}

#instantSupportTicketModal .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

#instantSupportTicketModal .modal-header .btn-close:hover {
    opacity: 1;
}

#instantSupportTicketModal .modal-body {
    padding: 18px 22px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

/* Context Badges Bar */
.ist-context-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    font-size: 12px;
}

.ist-context-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #475569;
}

.ist-context-item i {
    color: #3b82f6;
    font-size: 13px;
}

.ist-context-item strong {
    color: #0f172a;
    font-weight: 600;
}

.ist-context-badge {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* ==========================================================================
   Multi-Attachment & Screenshots Section
   ========================================================================== */
.ist-attachments-wrapper {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.ist-attachments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
}

.ist-attachments-actions {
    display: flex;
    gap: 6px;
}

.ist-attachments-actions .btn {
    padding: 3px 9px;
    font-size: 11.5px;
    border-radius: 4px;
}

/* Dropzone & Paste Region */
.ist-dropzone {
    background: #ffffff;
    border: 1.5px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin-bottom: 10px;
}

.ist-dropzone:hover,
.ist-dropzone.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.ist-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ist-dropzone-icon {
    font-size: 22px;
    color: #3b82f6;
    margin-bottom: 2px;
}

.ist-dropzone-text {
    font-size: 12.5px;
    color: #334155;
    font-weight: 500;
}

.ist-dropzone-text kbd {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    font-family: inherit;
}

.ist-dropzone-subtext {
    font-size: 11px;
    color: #64748b;
}

/* Attachment Gallery Grid */
.ist-attachment-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.ist-attachment-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.15s ease;
}

.ist-attachment-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.ist-att-thumb-wrapper {
    position: relative;
    height: 85px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ist-att-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.ist-att-thumb-wrapper:hover .ist-att-thumb-img {
    transform: scale(1.04);
}

.ist-att-file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.ist-att-file-icon i {
    font-size: 28px;
    margin-bottom: 2px;
}

.ist-att-file-ext {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: #e2e8f0;
    padding: 1px 4px;
    border-radius: 3px;
    color: #334155;
}

.ist-att-badge-type {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    z-index: 2;
}

.ist-att-badge-screenshot {
    background: rgba(14, 165, 233, 0.9);
    color: #ffffff;
}

.ist-att-badge-paste {
    background: rgba(168, 85, 247, 0.9);
    color: #ffffff;
}

.ist-att-badge-upload {
    background: rgba(71, 85, 105, 0.9);
    color: #ffffff;
}

.ist-att-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    border: none;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    opacity: 0.85;
    transition: all 0.15s ease;
}

.ist-att-remove-btn:hover {
    opacity: 1;
    background: #dc2626;
    transform: scale(1.15);
}

.ist-att-info {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
}

.ist-att-name {
    font-size: 11px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ist-att-size {
    font-size: 10px;
    color: #64748b;
}

/* Recent Errors Alert Section */
.ist-errors-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.ist-errors-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #991b1b;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 6px;
}

.ist-errors-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
    max-height: 120px;
    overflow-y: auto;
}

.ist-error-item {
    font-size: 12px;
    color: #b91c1c;
    background: #ffffff;
    border: 1px solid #fee2e2;
    border-radius: 4px;
    padding: 5px 8px;
    margin-bottom: 4px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.ist-error-item:last-child {
    margin-bottom: 0;
}

.ist-event-log-badge {
    background: #dc2626;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Form Controls */
#instantSupportTicketModal .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

#instantSupportTicketModal .form-control,
#instantSupportTicketModal .form-select {
    font-size: 13px;
    border-radius: 6px;
    border-color: #cbd5e1;
}

#instantSupportTicketModal .form-control:focus,
#instantSupportTicketModal .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ist-char-count {
    font-size: 11px;
    color: #64748b;
    text-align: right;
    margin-top: 2px;
}

/* Footer Actions */
#instantSupportTicketModal .modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ist-footer-info {
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Capture Spinner Overlay */
#istCaptureOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(3px);
    z-index: 2147483647 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-family: inherit;
}

#istCaptureOverlay .ist-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: istSpin 0.8s linear infinite;
    margin-bottom: 14px;
}

#istCaptureOverlay .ist-spinner-text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#istCaptureOverlay .ist-spinner-subtext {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

@keyframes istSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 767px) {
    #instantSupportTicketModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    #instantSupportTicketModal .modal-body {
        padding: 12px 14px;
        max-height: calc(85vh - 100px);
    }

    .ist-context-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .ist-attachments-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .ist-attachments-actions {
        width: 100%;
        justify-content: space-between;
    }

    .ist-attachment-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    #instantSupportTicketModal .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
        align-items: stretch;
    }

    #instantSupportTicketModal .modal-footer .btn {
        width: 100%;
    }

    .ist-footer-info {
        text-align: center;
        justify-content: center;
    }
}

/* ==========================================================================
   Screenshot Capture Forced Menu Collapse Rules
   ========================================================================== */
body.ist-taking-screenshot .animate-menu,
body.ist-taking-screenshot .animate-menu-left,
body.ist-taking-screenshot .animate-menu-right {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    transition: none !important;
    -webkit-transition: none !important;
    box-shadow: none !important;
}

body.ist-taking-screenshot .animate-menu-left .LOtext,
body.ist-taking-screenshot .animate-menu-left .ROtext,
body.ist-taking-screenshot .animate-menu-right .LOtext,
body.ist-taking-screenshot .animate-menu-right .ROtext,
body.ist-taking-screenshot .sidebar-submenu {
    display: none !important;
    opacity: 0 !important;
    max-width: 0 !important;
    visibility: hidden !important;
}

/* Ensure lightbox modal is always layered above instant support ticket modal */
.img-lightbox-overlay, .od-lightbox-overlay, #imageLightboxModal {
    z-index: 2147483647 !important;
}

