/* CSS Específico para o TrellDesk (Modal & Form) - Design Moderno & Compacto */

/* Scoped Styles para o Modal - Default Auto Height */
#modalServiceDesk .modal-dialog {
    width: 100%;
    margin: 1.75rem auto;
    transition: all 0.3s ease-in-out;
}

#modalServiceDesk .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background-color: #f8fafc;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Classe para altura total (usada na lista) */
#modalServiceDesk.modal-full-height .modal-dialog {
    height: calc(100% - 3.5rem);
}
#modalServiceDesk.modal-full-height .modal-content {
    height: 100%;
}

/* Header Compacto */
#modalServiceDesk .modal-header {
    background: #ffffff;
    padding: 1rem 1.5rem; /* Menor padding */
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0; /* Não encolhe */
}

/* Body com Scroll Interno */
#modalServiceDesk .modal-body {
    padding: 0;
    background-color: #f1f5f9; /* Slate-100 */
    flex: 1; /* Ocupa o resto do espaço */
    overflow-y: auto; /* Scroll apenas aqui */
    position: relative;
}

/* Containers de View */
#view-list, #view-form, #view-details {
    height: 100%; /* Garante que a view ocupe a altura */
    display: flex;
    flex-direction: column;
    padding: 24px;
}

#servicedesk-container-form, #details-content {
    flex: 1;
}

/* Tabela com Header Fixo */
.table-responsive {
    overflow-x: auto;
    max-height: calc(100vh - 350px); /* Altura dinâmica aproximada */
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    background: white;
}

#table-meus-tickets {
    margin-bottom: 0; /* Remove margem inferior padrão */
}

#table-meus-tickets thead th {
    position: sticky;
    top: 0;
    background: transparent; /* Cor do header */
    z-index: 10;
    box-shadow: 0 1px 0 #e2e8f0; /* Borda inferior simulada */
}

/* Toolbar de Filtros - Mais clean */
.sd-toolbar {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-bottom: 16px !important;
}

/* Inputs Compactos */
#modalServiceDesk .form-control, 
#modalServiceDesk .select2-container--default .select2-selection--single {
    height: 36px !important; /* Altura reduzida */
    font-size: 13px;
    border-radius: 6px !important;
    border-color: #cbd5e1 !important;
    outline: none !important;
    transition: all 0.2s ease;
}

#modalServiceDesk #filters-container .select2-container--default .select2-selection--single {
    height: 43px !important; 
}

#modalServiceDesk #filters-container .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 39px !important; 
}

#modalServiceDesk .form-control:focus,
#modalServiceDesk .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

#modalServiceDesk .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px !important;
}

#modalServiceDesk .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px !important;
}

/* Inputs Compactos */
#modalServiceDesk .form-control, 
#modalServiceDesk.select2-container--default.select2-container--focus .select2-selection--multiple {
    height: 36px !important; /* Altura reduzida */
    font-size: 13px;
    border-radius: 6px !important;
    border-color: #cbd5e1 !important;
    outline: none !important;
    transition: all 0.2s ease;
}

#modalServiceDesk .form-control:focus,
#modalServiceDesk .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

#modalServiceDesk .select2-container--default .select2-selection--multiple {
    min-height: 42px;
    padding: 6px;
    border: 1px solid rgb(203, 213, 225);
}

/* Labels menores */
#modalServiceDesk label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    display: block;
}

/* Botões Compactos */
#modalServiceDesk .btn {
    padding: 0.4rem 1rem;
    font-size: 13px;
    height: 36px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: all 0.2s;
    outline: none !important; /* Remove borda preta padrão ao clicar */
    box-shadow: none !important;
}

#modalServiceDesk .btn:focus,
#modalServiceDesk .btn:active,
#modalServiceDesk .btn:active:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

#modalServiceDesk .btn-primary {
    color: #ffffff !important;
    background-color: #2563eb !important;
    border: 1px solid transparent;
}

#modalServiceDesk .btn-primary:hover {
    background-color: #1d4ed8 !important;
}

#modalServiceDesk .btn-danger {
    color: #ef4444;
    background-color: #ffffff;
    border: 1px solid #fecaca;
}

#modalServiceDesk .btn-danger:hover {
    background-color: #fef2f2;
}

/* Paginação Compacta */
#sd-pagination button {
    height: 32px;
    width: 32px;
    font-size: 12px;
    border-radius: 6px;
}

/* Cards de Formulário */
#modalServiceDesk .sd-card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 16px;
}

/* Grid de Formulário Otimizado (2 colunas em telas maiores) */
@media (min-width: 992px) {
    .form-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    .form-full-width {
        grid-column: span 2;
    }
}

/* Dropzone Compacto */
#modalServiceDesk .dropzone-container {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    background-color: #f8fafc;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width:100%;
}
#modalServiceDesk .dropzone-container:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}
#modalServiceDesk .dz-icon { font-size: 2rem; margin-bottom: 0.5rem; color: #94a3b8; }
#modalServiceDesk .dz-text { font-size: 13px; font-weight: 500; color: #475569; }
#modalServiceDesk .dz-subtext { font-size: 11px; color: #94a3b8; }

/* Ajuste de altura da descrição para alinhar com dropzone se estiver em row */
#sd-description {
    min-height: 120px;
}

/* Comentários - Estilo Chat */
.comment-item {
    animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Header Icon */
#modalServiceDesk .header-icon {
    font-size: 20px;
    padding: 8px;
    border-radius: 6px;
    color: #2563eb;
    background: #eff6ff;
}
#modalServiceDesk .header-icon i { vertical-align: middle; }
#modalServiceDesk .modal-title { 
    font-size: 1.25rem; 
    font-weight: 700; 
    color: #1f2937; 
}

/* Remove default margins in rows within modal */
#modalServiceDesk .row {
    margin-left: -8px;
    margin-right: -8px;
}
#modalServiceDesk [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
}

/* Select Customizado */
#modalServiceDesk select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
    padding-right: 2rem;
    -webkit-appearance: none;
    appearance: none;
}

/* Skeleton Loading */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.4; }
    100% { opacity: 0.6; }
}
#modalServiceDesk .skeleton-row {
    animation: pulse 1.5s infinite ease-in-out;
    background: #e2e8f0;
    border-radius: 6px;
}

/* Custom Scrollbar */
#modalServiceDesk .modal-body::-webkit-scrollbar { width: 6px; }
#modalServiceDesk .modal-body::-webkit-scrollbar-track { background: transparent; }
#modalServiceDesk .modal-body::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 3px; }

/* Filter Group styling */
#modalServiceDesk .btn-filter-type {
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0; /* Individual borders look better */
    font-size: 12px;
}
#modalServiceDesk .btn-filter-type.active {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
    z-index: 1;
}
#modalServiceDesk .btn-group {
    display: flex;
    width: 100%;
}
#modalServiceDesk .btn-group .btn {
    flex: 1;
    border-radius: 0;
}
#modalServiceDesk .btn-group .btn:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
#modalServiceDesk .btn-group .btn:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }

/* Footer de Ações */
#modalServiceDesk .modal-footer-custom {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    margin-top: auto; /* Push to bottom if flex container */
    border-top: 1px solid #e2e8f0;
}

/* Alerts */
#modalServiceDesk .alert {
    border: none;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
#modalServiceDesk .alert-success { background-color: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }
#modalServiceDesk .alert-danger { background-color: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }

#modalServiceDesk select:focus{
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

/* Sortable Headers */
#modalServiceDesk th.sortable { cursor: pointer; user-select: none; }
#modalServiceDesk th.sortable:hover { background-color: #f1f5f9; }

/* Dropzone Previews - Lista Organizada */
#modalServiceDesk .dz-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.2s;
}

#modalServiceDesk .dz-preview:hover {
    border-color: #cbd5e1;
    background-color: #fafafa;
}

#modalServiceDesk .file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    flex: 1;
}

#modalServiceDesk .file-icon {
    font-size: 20px;
    color: #64748b;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 6px;
}

#modalServiceDesk .dz-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#modalServiceDesk .file-name {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#modalServiceDesk .file-size {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}

#modalServiceDesk .file-action {
    margin-left: 12px;
    flex-shrink: 0;
}

#modalServiceDesk .remove-btn {
    color: #ef4444;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

#modalServiceDesk .remove-btn:hover {
    background-color: #fee2e2;
}

/* Remove barra de progresso padrão do Dropzone se estiver aparecendo e quebrando layout */
#modalServiceDesk .dz-progress {
    display: none; 
}
