@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Outfit:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Main Palette */
    --bg-color: #0f172a;
    /* Deep Slate Navy */
    --card-bg: #1e293b;
    --primary-color: #22c55e;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    /* Lighter Slate for better contrast on dark backgrounds */

    /* Status Colors */
    --status-aguardando: #9E9E9E;
    --status-autorizado: #2196F3;
    --status-descarga: #FF9800;
    --status-carga: #9C27B0;
    --status-finalizado: #4CAF50;
    /* --status-liberado: #8b5cf6; */
    --status-suspenso: #F44336;

    /* Spacing & Sizes for TV */
    --font-base: 18px;
    --heading-size: 2.2rem;
    --body-size: 1.25rem;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    font-size: var(--font-base);
    min-height: 100vh;
    overflow-x: hidden;
}

main {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* Header Section */
.container_header {
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.container_header .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: linear-gradient(90deg, #166534 0%, #14532d 100%);
    padding: 1rem 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    gap: 1.5rem;
}

.logo {
    height: 48px;
    width: 48px;
    background: #ffffff;
    padding: 6px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    object-fit: contain;
}

.title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.title p {
    font-family: 'Outfit', sans-serif;
    font-size: var(--heading-size);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.today {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.add_new_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.add_new_btn:hover {
    transform: scale(1.1) rotate(90deg);
    background-color: #16a34a;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6);
}

.add_new_btn svg {
    width: 28px;
    height: 28px;
}

.container_header .today p {

    font-size: 1.1rem;
    font-weight: 700;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Status Summary Box */
.status_box {
    background-color: var(--card-bg);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.status_button {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    text-transform: uppercase;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.25rem;
    min-width: 12rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Dynamic Status Styles */
.status-type-aguardando {
    color: var(--status-aguardando);
    border-color: rgba(158, 158, 158, 0.3);
}

.status-type-autorizado {
    color: var(--status-autorizado);
    border-color: rgba(33, 150, 243, 0.3);
}

.status-type-descarga {
    color: var(--status-descarga);
    border-color: rgba(255, 152, 0, 0.3);
}

.status-type-carga {
    color: var(--status-carga);
    border-color: rgba(156, 39, 176, 0.3);
}

.status-type-finalizado {
    color: var(--status-finalizado);
    border-color: rgba(76, 175, 80, 0.3);
}

.status-type-liberado {
    color: var(--status-liberado);
    border-color: rgba(139, 92, 246, 0.3);
}

.status-type-suspenso {
    color: var(--status-suspenso);
    border-color: rgba(244, 67, 54, 0.3);
}

.status_circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.status_count {
    font-size: 1rem;
    font-style: normal;
    font-weight: 900;
    color: var(--text-main);
}

/* Dashboard Card Layout */
.dashboard_header {
    display: flex;
    padding: 1rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.dashboard_list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.movement_card {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    padding: 1.25rem 0.5rem;
    border-radius: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.movement_card:hover {
    transform: translateY(-4px) scale(1.01);
    background-color: #243147;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.card_col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    /* Alinhamento padrão à esquerda (Produto e Fornecedor) */
}

.card_col .mobile_label {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.card_col .val {
    font-size: var(--body-size);
    font-weight: 600;
    color: var(--text-main);
}

/* Column Widths (Shared between header and card) */
.col-status {
    width: 4%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.col-volume,
.col-placa,
.col-chegada,
.col-tempo {
    align-items: center;
}

.col-plat {
    width: 7%;
    text-align: center;
    align-items: center;
}

.col-produto {
    width: 27%;
}

.col-fornecedor {
    width: 23%;
}

.col-volume {
    width: 7%;
    text-align: center;
}

.col-placa {
    width: 10%;
    text-align: center;
}

.col-chegada {
    width: 8%;
    text-align: center;
}

.col-tempo {
    width: 9%;
    text-align: center;
}

.col-acao {
    width: 5%;
    align-items: right;
}

/* Status accent line on the left of the card */
.movement_card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: currentColor;
    opacity: 0.8;
    z-index: 1;
}

/* Ocultar faixa lateral no Desktop */
@media (min-width: 1025px) {
    .movement_card::before {
        display: none;
    }
}

/* Time-based Feedback */
.time-warning {
    color: #facc15 !important;
    /* Yellow-400 */
}

.time-danger {
    color: #f87171 !important;
    /* Red-400 */
}

/* Badges */
.status_badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 800;
    background-color: rgba(255, 255, 255, 0.05);
}

.status_dot {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.plate_badge {
    background-color: #e2e8f0;
    color: #1e293b;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    border: 2px solid #1e293b;
}

/* Form Styling */
.form_container {
    max-width: 600px;
    margin: 2rem auto;
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.form_title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--primary-color);
    text-align: center;
}

.form_group {
    margin-bottom: 1.5rem;
}

.form_group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.form_group input,
.form_group select {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.form_group input:focus,
.form_group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(34, 197, 94, 0.05);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.btn_submit {
    width: 100%;
    background: linear-gradient(90deg, #166534 0%, #14532d 100%);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

.btn_submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(22, 101, 52, 0.4);
    filter: brightness(1.1);
}

.btn_submit:active {
    transform: translateY(0);
}

.btn_back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.btn_back:hover {
    color: var(--text-main);
}

/* Autocomplete Styles */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: rgba(34, 197, 94, 0.15);
}

.autocomplete-item .supplier-name {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
}

.autocomplete-item .supplier-cnpj {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Custom Scrollbar for results */
.autocomplete-results::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-results::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Custom Select Styles */
.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-select-trigger::after {
    content: '▼';
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.custom-select-container.active .custom-select-trigger {
    border-color: var(--primary-color);
    background-color: rgba(34, 197, 94, 0.05);
}

.custom-select-container.active .custom-select-trigger::after {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
}

.custom-select-container.active .custom-select-options {
    display: block;
}

.custom-option {
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background-color: rgba(34, 197, 94, 0.15);
}

.custom-option.selected {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--primary-color);
    font-weight: 700;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ef4444;
}

.movement-info {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.movement-info p {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Edit Action Icon */
.edit-status-btn {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-status-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Custom Select Reuse in Index */
.modal-body .custom-select-container {
    width: 100%;
}

.modal-body .custom-select-trigger {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsiveness */

/* Tablets and Mobile (1024px and below) */
@media (max-width: 1024px) {
    :root {
        --font-base: 16px;
        --heading-size: 1.8rem;
        --body-size: 1.1rem;
    }

    .dashboard_header {
        display: none;
        /* Hide top header on tablets/mobile */
    }

    .dashboard_list {
        margin-top: 1.5rem;
        /* Adicionado para dar espaço no mobile */
    }

    .movement_card {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 1.25rem 1rem;
        gap: 1.5rem 0;
        /* Vertical gap, no horizontal gap needed when using bits of 100% and 50% */
    }

    .card_col {
        text-align: left !important;
        align-items: flex-start !important;
    }

    /* Primary fields: Full width */
    .col-produto,
    .col-fornecedor {
        width: 100% !important;
    }

    /* Secondary fields: Two columns (50% each) */
    .col-plat,
    .col-volume,
    .col-placa,
    .col-chegada,
    .col-tempo {
        width: 50% !important;
    }

    .card_col .mobile_label {
        display: block;
    }

    .card_col.col-status {
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        width: auto !important;
    }

    .card_col.col-acao {
        position: absolute;
        bottom: 1.5rem;
        right: 1.5rem;
        width: auto !important;
    }

    .col-status .mobile_label,
    .col-acao .mobile_label {
        display: none;
    }

    .status_button {
        min-width: calc(50% - 0.75rem);
        flex: 1;
    }
}

/* Mobile Devices (768px and below) */
@media (max-width: 768px) {
    .container_header .header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .header .title {
        text-align: center;
    }

    .status_box {
        padding: 1rem;
    }

    .status {
        gap: 0.75rem;
    }

    .form_container {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }

    .btn_submit {
        padding: 1rem;
        font-size: 1rem;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    :root {
        --heading-size: 1.4rem;
    }

    .status_button {
        min-width: 100%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .back_button .btn_back {
        font-size: 0.9rem;
    }
}

/* Platform Selection Grid */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.platform-option {
    position: relative;
}

.platform-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.platform-label {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.platform-option input:checked+.platform-label {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.platform-option input:disabled+.platform-label {
    opacity: 0.3;
    cursor: not-allowed;
    background: #0f172a;
    border-color: #334155;
}

.platform-option input:not(:disabled):hover+.platform-label {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

@media (max-width: 480px) {
    .platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}