/*
 * CastraPET - Página de Histórico de Movimentações
 * Estilos específicos para tabela cronológica e filtros
 */

/* ===== FILTERS CARD ===== */
.filters-card {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.filters-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.filters-row:last-child {
    margin-bottom: 0;
}

.filters-row-secondary {
    align-items: flex-end;
    border-top: 1px dashed var(--border-color);
    padding-top: var(--spacing-md);
}

/* ===== MOVEMENT PATH ===== */
.movement-path {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.movement-path .origin {
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

.movement-path .arrow {
    color: var(--color-primary-light);
    font-weight: bold;
}

.movement-path .destination {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

/* ===== TABLE ADJUSTMENTS ===== */
.material-summary {
    max-width: 300px;
}

.font-mono {
    font-family: 'DM Mono', monospace;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.badge-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    border: 1px solid var(--border-color);
}

/* ===== MODAL DETALHES ===== */
.detalhes-header {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
}

.detalhes-info-item {
    display: flex;
    flex-direction: column;
}

.detalhes-info-item .label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detalhes-info-item .value {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.detalhes-locais {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-lg);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-lg);
}

.local-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.local-box .label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.local-box .value {
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.local-arrow {
    font-size: 24px;
    color: var(--color-primary);
}

.detalhes-items-list h4,
.detalhes-obs h4 {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-xs);
    border-left: 3px solid var(--color-primary);
}

.detalhes-obs p {
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    font-style: italic;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ===== TABLE SMALL ===== */
.table-sm {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-lg);
}

.table-sm th {
    text-align: left;
    padding: var(--spacing-sm);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.table-sm td {
    padding: var(--spacing-sm);
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--border-color);
}

.edit-notice {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.edit-notice.warning {
    border-color: rgba(217, 119, 6, 0.24);
    background-color: rgba(245, 158, 11, 0.12);
    color: #9a6700;
}

.modal-edit-history {
    max-width: min(1100px, calc(100vw - 32px)) !important;
}

.modal-edit-history .modal-body {
    overflow-x: hidden;
}

.modal-edit-history .edit-items-wrapper .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-edit-history .table-sm {
    width: 100%;
    min-width: 860px;
    table-layout: fixed;
}

.modal-edit-history .table-sm th:first-child,
.modal-edit-history .table-sm td:first-child {
    width: 24%;
}

.modal-edit-history .table-sm th:nth-child(2),
.modal-edit-history .table-sm td:nth-child(2) {
    width: 11%;
}

.modal-edit-history .table-sm th:nth-child(3),
.modal-edit-history .table-sm td:nth-child(3) {
    width: 16%;
}

.modal-edit-history .table-sm th:nth-child(4),
.modal-edit-history .table-sm td:nth-child(4) {
    width: 16%;
}

.modal-edit-history .table-sm th:nth-child(5),
.modal-edit-history .table-sm td:nth-child(5) {
    width: 16%;
}

.modal-edit-history .table-sm th:last-child,
.modal-edit-history .table-sm td:last-child {
    width: 17%;
}

.edit-readonly {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
}

.edit-inline-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.edit-inline-text {
    display: block;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

.edit-inline-text strong {
    color: var(--text-primary);
}

.edit-table-actions {
    display: flex;
    justify-content: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .filters-row {
        flex-direction: column;
    }

    .detalhes-header {
        grid-template-columns: 1fr;
    }

    .detalhes-locais {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .local-arrow {
        transform: rotate(90deg);
    }

    .modal-edit-history {
        max-width: calc(100vw - 24px) !important;
    }
}

@media (max-width: 767px) {
    .modal-edit-history .table-sm,
    .modal-edit-history .table-sm tbody,
    .modal-edit-history .table-sm tr,
    .modal-edit-history .table-sm td {
        display: block;
        width: 100% !important;
        min-width: 0;
    }

    .modal-edit-history .table-sm {
        min-width: 0;
    }

    .modal-edit-history .table-sm thead {
        display: none;
    }

    .modal-edit-history .table-sm tbody tr {
        margin-bottom: var(--spacing-md);
        padding: var(--spacing-md);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-md);
        background-color: var(--bg-secondary);
    }

    .modal-edit-history .table-sm tbody td {
        border-bottom: none;
        padding: 0;
        margin-bottom: var(--spacing-sm);
    }

    .modal-edit-history .table-sm tbody td:last-child {
        margin-bottom: 0;
    }

    .modal-edit-history .table-sm tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: var(--spacing-xs);
        font-size: var(--font-size-xs);
        font-weight: var(--font-weight-bold);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-muted);
    }

    .modal-edit-history .edit-table-actions {
        justify-content: stretch;
    }

    .modal-edit-history .edit-table-actions .btn {
        width: 100%;
    }
}
