/**
 * Tickets Index Page Styles
 * Specific styles for the tickets list page
 */

/* ============================================================================
   SEARCH ROW STYLES
   ============================================================================ */
.sd-search-row th {
    padding: 6px 8px !important;
    vertical-align: middle;
    overflow: visible !important;
}

.sd-search-row .sd-search-input {
    width: 100%;
    height: 32px;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: border-color 0.15s ease;
}

.sd-search-row .sd-search-input:focus {
    border-color: var(--sd-primary);
    box-shadow: 0 0 0 0.15rem rgba(var(--sd-primary-rgb), 0.25);
    outline: none;
}

.sd-search-row .sd-search-input::placeholder {
    color: #adb5bd;
    font-size: 11px;
}

/* Multi-select search component */
.multi-select-search {
    position: relative;
    width: 100%;
}

.multi-select-display {
    width: 100%;
    height: 32px;
    min-height: 32px;
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.multi-select-display:hover {
    border-color: var(--sd-primary);
}

.multi-select-display .placeholder {
    color: #adb5bd;
    font-size: 11px;
    flex: 1;
}

.multi-select-icon {
    margin-left: auto;
    font-size: 9px;
    color: #6c757d;
    transition: transform 0.2s;
}

.multi-select-search.open .multi-select-icon {
    transform: rotate(180deg);
}

.multi-select-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 5px;
    background: var(--sd-primary);
    color: white;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
}

.multi-select-more {
    font-size: 9px;
    color: var(--sd-primary);
    font-weight: 600;
}

.multi-select-dropdown {
    position: fixed;
    background: white;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 99999;
    max-height: 240px;
    overflow-y: auto;
    min-width: 180px;
}

.multi-select-option {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f3f5;
}

.multi-select-option:last-child {
    border-bottom: none;
}

.multi-select-option:hover {
    background: rgba(var(--sd-primary-rgb), 0.06);
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--sd-primary);
}

.multi-select-option input[type="checkbox"]:checked {
    background: var(--sd-primary);
}

.multi-select-option label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    user-select: none;
    font-weight: 500;
    color: #344054;
}

/* ============================================================================
   SORTABLE HEADERS
   ============================================================================ */
th[data-sortable] {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

th[data-sortable]:hover {
    background: #f0f2f5;
    color: #2c3e50;
}

.sd-sort-indicator {
    font-size: 10px;
    color: #5a6c7d;
    margin-left: 4px;
}

/* ============================================================================
   CUSTOM CONFIRM MODAL
   ============================================================================ */
.sd-confirm-modal {
    max-width: 450px;
}

.sd-confirm-modal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.sd-confirm-modal .modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px 12px 0 0;
}

.sd-confirm-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sd-primary) 0%, rgba(var(--sd-primary-rgb), 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--sd-primary-rgb), 0.3);
}

.sd-confirm-modal .modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.sd-confirm-modal .btn-close {
    font-size: 11px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.sd-confirm-modal .btn-close:hover {
    opacity: 1;
}

.sd-confirm-modal .modal-body {
    padding: 24px;
    background: white;
}

.sd-confirm-message {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
    margin: 0;
    font-weight: 500;
}

.sd-confirm-modal .modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 16px 24px;
    gap: 10px;
    border-radius: 0 0 12px 12px;
}

.sd-confirm-cancel,
.sd-confirm-btn {
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.sd-confirm-cancel {
    background: white;
    border: 2px solid #e2e8f0;
    color: #64748b;
}

.sd-confirm-cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sd-confirm-btn {
    background: linear-gradient(135deg, var(--sd-primary) 0%, rgba(var(--sd-primary-rgb), 0.85) 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(var(--sd-primary-rgb), 0.25);
}

.sd-confirm-btn:hover {
    background: linear-gradient(135deg, rgba(var(--sd-primary-rgb), 0.9) 0%, rgba(var(--sd-primary-rgb), 0.75) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--sd-primary-rgb), 0.35);
}

.sd-confirm-btn:active {
    transform: translateY(0);
}

/* ============================================================================
   TABLE ENHANCEMENTS
   ============================================================================ */
.sd-data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.sd-data-table thead tr:first-child th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fafbfc;
}

.sd-data-table thead tr.sd-search-row th {
    position: sticky;
    top: 45px;
    z-index: 9;
    background: white;
}

/* Column widths */
.sd-col-checkbox { width: 40px; min-width: 40px; }
.sd-col-id { width: 110px; min-width: 110px; }
.sd-col-subject { width: 300px; min-width: 200px; }
.sd-col-requester { width: 200px; min-width: 150px; }
.sd-col-status { width: 120px; min-width: 120px; }
.sd-col-priority { width: 110px; min-width: 110px; }
.sd-col-category { width: 140px; min-width: 120px; }
.sd-col-subcategory { width: 150px; min-width: 130px; }
.sd-col-item { width: 140px; min-width: 120px; }
.sd-col-agent { width: 160px; min-width: 140px; }
.sd-col-department { width: 140px; min-width: 120px; }
.sd-col-mode { width: 100px; min-width: 100px; }
.sd-col-impact { width: 100px; min-width: 100px; }
.sd-col-urgency { width: 100px; min-width: 100px; }
.sd-col-created { width: 130px; min-width: 130px; }
.sd-col-updated { width: 130px; min-width: 130px; }
.sd-col-due_date { width: 120px; min-width: 120px; }
.sd-col-resolved_at { width: 140px; min-width: 140px; }

/* Ensure cells don't collapse */
.sd-data-table th,
.sd-data-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Subject column can wrap */
.sd-col-subject {
    white-space: normal;
    word-wrap: break-word;
}

/* ============================================================================
   RESPONSIVE BEHAVIOR
   ============================================================================ */
@media (max-width: 1400px) {
    .sd-col-subcategory,
    .sd-col-item,
    .sd-col-updated,
    .sd-col-due_date,
    .sd-col-resolved_at {
        display: none !important;
    }
}

@media (max-width: 1200px) {
    .sd-col-department,
    .sd-col-mode,
    .sd-col-impact,
    .sd-col-urgency {
        display: none !important;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.sd-icon-clickable {
    cursor: pointer;
    transition: color 0.15s ease;
}

.sd-icon-clickable:hover {
    color: var(--sd-primary);
}

.sd-fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== Spacing between toolbar and content ========== */
.sd-toolbar {
    margin-bottom: 20px;
}

.sd-table-container {
    margin-top: 0;
}

/* ============================================================================
   ACTION BUTTONS (Edit & Conversations)
   ============================================================================ */
.sd-col-edit,
.sd-col-conversations {
    text-align: center;
    width: 50px;
}

.sd-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    color: #5a6c7d;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sd-action-btn:hover {
    background: #ffffff;
    border-color: #b8c0ca;
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.sd-action-btn:active {
    background: #f0f2f5;
    border-color: #b8c0ca;
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Conversations button with conversations */
.sd-action-btn.has-conversations {
    color: var(--sd-primary);
    border-color: var(--sd-primary);
    background: linear-gradient(135deg, rgba(var(--sd-primary-rgb), 0.08), rgba(var(--sd-primary-rgb), 0.04));
}

.sd-action-btn.has-conversations:hover {
    background: linear-gradient(135deg, rgba(var(--sd-primary-rgb), 0.15), rgba(var(--sd-primary-rgb), 0.08));
    border-color: var(--sd-primary);
    box-shadow: 0 3px 12px rgba(var(--sd-primary-rgb), 0.25);
    transform: translateY(-2px);
}

/* Conversation count badge */
.conv-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--sd-primary);
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   CONVERSATIONS MODAL STYLING
   ============================================================================ */
#conversationsModal .modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

#conversationsModal .modal-header {
    background: linear-gradient(to bottom, #fafbfc, #ffffff);
    border-bottom: 1px solid #e8ecf0;
    padding: 14px 20px;
}

#conversationsModal .modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.2px;
}

#conversationsModal .modal-title i {
    color: var(--sd-primary);
    font-size: 14px;
}

#conversationsModal .btn-close {
    font-size: 11px;
    opacity: 0.6;
}

#conversationsModal .btn-close:hover {
    opacity: 1;
}

#conversationsModal .conversations-header {
    background: #f8f9fa;
    padding: 12px 20px;
}

#conversationsModal .modal-body {
    background: #ffffff;
}
