/*----------  VARIABLES GLOBALES  ----------*/
:root {
    --primary-gradient: linear-gradient(90deg, #ff9a3b, #ff9215);
    --edition-gradient: linear-gradient(90deg, #6842d5, #8a53e6);
    --highlight: #ff9215;
    --highlight-hover: #ff8800;
    --btn-primary: #007bff;
    --btn-danger: #ff0000;
    --btn-success: #00c023;
    --btn-disabled: gray;
    --row-height: 60px;
}

/*----------  ESTILOS BASE  ----------*/
body {
    background: var(--primary-gradient);
    background-attachment: fixed;
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
}

#edicion-page {
    background: var(--edition-gradient);
    background-attachment: fixed;
    font-family: Arial, sans-serif;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 20px;
    font-size: 2rem;
}

.carrier-legend {
    text-align: center;
    color: white;
    font-size: 0.9rem;
    margin-top: -10px;
    margin-bottom: 10px;
}

.tabla-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
    width: 100%;
    overflow-x: auto;
}

#tabla2,
#tabla-edicion {
    width: 600px !important;
    max-width: 600px !important;
    table-layout: fixed !important;
    border-collapse: collapse;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#tabla2-wrapper,
#tabla-edicion-wrapper {
    width: 600px !important;
    max-width: 600px !important;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 4px;
}

#tabla2 tbody tr.selected {
    background-color: var(--highlight) !important;
    color: #fff;
    transition: background-color 0.2s ease;
}

#tabla-edicion tbody tr.selected {
    background-color: #9500ff !important;
    color: #fff;
    transition: background-color 0.2s ease;
}

#tabla2 tbody tr.selected:hover {
    background-color: var(--highlight-hover) !important;
    transition: background-color 0.2s ease;
}

#tabla-edicion tbody tr.selected:hover {
    background-color: #7a00d0 !important;
    transition: background-color 0.2s ease;
}

#tabla2 tbody tr.selected td,
#tabla-edicion tbody tr.selected td {
    border: none !important;
    box-shadow: none !important;
}

#tabla2 tbody tr:hover,
#tabla-edicion tbody tr:hover {
    background-color: #f0f0f0 !important;
}

#tabla2 tbody tr.purple-carrier {
    background-color: #e0c8ff;
}

#tabla2 tbody tr.purple-carrier:hover {
    background-color: #d4b3ff !important;
}

#tabla2 tbody tr.purple-carrier.selected {
    background-color: #b57dff !important;
    color: #fff;
}

#tabla2 tbody tr.purple-carrier.selected:hover {
    background-color: #a45cff !important;
}

#tabla2 tbody tr.overdue {
    background-color: rgba(255, 0, 0, 0.4) !important;
}

#tabla2 tbody tr.overdue:hover {
    background-color: rgba(255, 0, 0, 0.5) !important;
}

#tabla2 tbody tr.overdue.selected,
#tabla2 tbody tr.overdue.selected:hover {
    background-color: rgba(255, 0, 0, 0.5) !important;
}

/* Pedidos atrasados de carriers prioritarios no se resaltan en rojo */
#tabla2 tbody tr.overdue-priority {
    background-color: #8A2BE2; /* Violeta */
    color: #fff;
}

table.dataTable {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin: 0 auto;
    font-size: 14px;
}

table.dataTable tbody tr {
    height: var(--row-height);
}

table.dataTable td,
table.dataTable th {
    padding: 6px 12px;
    text-align: start;
    vertical-align: middle;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
}


table.dataTable thead th {
    font-weight: bold;
    background-color: #f2f2f2;
    border-bottom: 1px solid #ddd;
}

/*----------  MENÚ LATERAL  ----------*/

.hamburger-button {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1050;
    background-color: #444;
    opacity: 0.9;
    color: #fff;
    border: none;
    font-size: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.hamburger-button i {
    margin: 0;
}

.hamburger-button:active {
    transform: scale(0.9);
}

.hamburger-button:disabled {
    background-color: #888;
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
}

.menu-title {
    font-size: 20px;
    font-weight: bold;
    color: white;
    text-align: center;
    margin: 15px 0;
    padding: 10px 0;
    border-bottom: 1px solid #555;
}

.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 200px;
    height: 100%;
    background-color: #353535;
    color: white;
    padding: 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
    z-index: 1050;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
}

.menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu ul li {
    margin: 0;
    padding: 10px 15px;
    transition: background-color 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

.menu ul li a {
    display: block;
    color: white;
    text-decoration: none;
    font-size: 18px;
}

.menu ul li:hover {
    background-color: #fff;
    color: #333;
}

.menu ul li:hover a {
    color: #333;
}

.menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 4px;
}


.menu-overlay {
    display: none;

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);

    z-index: 1040;

}

.menu.active+#menu-overlay {
    display: block;

}

#panel {
    transition: transform 0.3s ease;
}

.contador-selecciones {
    margin-left: auto;
    position: absolute;
    top: 40px;
    right: 0;
    font-weight: bold;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 8px;
    border-radius: 5px;
    z-index: 100;
}

.swal2-select {
    font-size: 14px;
    width: 80%;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    align-self: center;
}

.botones-seleccion {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    width: 100%;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 4px;
    background-color: var(--btn-success);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-danger {
    background-color: var(--btn-danger);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 4px 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-container {
    flex-grow: 1;
    display: flex;
    gap: 5px;
}

.search-container input {
    width: 80%;
    padding: 4px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 13px;
}

.search-container button {
    padding: 5px 5px;
    background-color: #1e90ff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#id-search,
#id-search-edicion {
    flex-grow: 1;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
    transition: outline 0.3s ease;
    outline: none;

    transition: none;

}

#search-button,
#search-button-edicion {
    padding: 5px 5px;
    background-color: var(--btn-primary);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}


#buttons-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;

    justify-content: center;
    align-items: center;
    z-index: 1000;

}


#assign-button {
    position: static;
    transform: none;
    padding: 15px 15px;
    font-size: 16px;
    color: #fff;
    background-color: var(--btn-disabled);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}


#assign-button .btn-icon {
    width: 25px;
    height: 25px;
    vertical-align: middle;
}

.swal2-title {
    font-size: 16px;
    line-height: 1.2;
}

.swal2-confirm[disabled] {
    background-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.swal2-confirm {
    transition: background-color 0.3s, color 0.3s, opacity 0.3s;
}

.swal2-container {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.4);
}

.login-input {
    font-size: 14px;
    width: 80%;
    height: auto;
    padding: 8px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
    outline: none;
}

input[type="date"].login-input,
input[type="time"].login-input {
    width: 100%;
}

#edit-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 15px;
    font-size: 16px;
    background-color: #d400ff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#edit-button .btn-icon {
    width: 25px;
    height: 25px;
    vertical-align: middle;
}

#home-button {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background-color: #4CAF50;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#home-button:active {
    transform: scale(0.95);
}

#home-button .btn-icon {
    width: 24px;
    height: 24px;
}

#timer-container,
#timer-container-edicion {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 14px;
    color: #000000;
}

#timer,
#timer-edicion {
    font-weight: bold;
    color: #000000;
}

#refresh-button,
#refresh-button-edicion {
    width: 22px;
    height: 22px;
    background-color: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#refresh-button img,
#refresh-button-edicion img {
    width: 15px;
    height: 15px;
}

#refresh-button:active,
#refresh-button-edicion:active {
    transform: scale(0.9);
}


@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-2px);
    }

    50% {
        transform: translateX(2px);
    }

    75% {
        transform: translateX(-2px);
    }
}

.shake {
    animation: shake 0.15s;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }
}

.bounce {
    animation: bounce 0.15s ease-in-out;
}

@media (max-width: 768px) {

    body {
        background-size: auto 100px;
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .tabla-container {
        padding: 2px;
    }

    #tabla2,
    #tabla2-wrapper,
    #tabla-edicion,
    #tabla-edicion-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    table.dataTable {
        font-size: 11px;
    }

    table.dataTable tbody tr {
        height: var(--row-height);
    }

    table.dataTable td,
    table.dataTable th {
        padding: 4px 8px;
        white-space: nowrap;
    }

    #buttons-container {
        bottom: 12px;
        gap: 5px;
    }

    #assign-button {
        padding: 10px;
        font-size: 14px;
    }

    #assign-button .btn-icon {
        width: 20px;
        height: 20px;
    }

    #edit-button {
        bottom: 12px;
    }
}

#welcome-message {
    text-align: center;
    color: white;
    font-size: 1.2rem;
}

#welcome-text .username {
    font-weight: bold;
}

.menu ul li {
    margin: 0;
    padding: 15px 20px;
    font-size: 18px;
    transition: background-color 0.3s ease;
}

.menu ul li.selected {
    background-color: #555;
    font-weight: bold;
}

.menu ul li.reset-filters:hover {
    background: none;
    color: inherit;
}

.menu ul li button.reset-sucursales-btn {
    display: block;
    width: 100%;
    margin: 5px 0;
    padding: 10px 15px;
    background-color: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    font: inherit;
    text-align: center;
    cursor: pointer;
}

.menu ul li button.reset-sucursales-btn:hover {
    background-color: #444;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

#loading-overlay div {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
}

.sucursal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1200;
}

.sucursal-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    color: #000;
    border-radius: 10px;
    padding: 20px;
    width: 80%;
    max-width: 400px;
    max-height: 70%;
    overflow-y: auto;
    z-index: 1300;
}

.sucursal-modal-header {
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.sucursal-modal-list {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sucursal-modal-list label {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 16px;
}

.sucursal-modal-list input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--btn-primary);
}

.sucursal-modal-apply {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

.carrier-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    background-color: transparent;
}

.carrier-indicator.active {
    background-color: var(--highlight);
    box-shadow: 0 0 5px var(--highlight);
}