/* Estilos Generales y del Body */
body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f4f8;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    padding-top: 80px;
}

.main-wrapper {
    max-width: 1800px;
    width: 95%;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

h1 {
    grid-column: 1 / -1;
    text-align: left;
    color: #333333;
    margin-bottom: 30px;
    font-size: 32px;
    font-weight: 600;
    padding-bottom: 15px;
    border-bottom: 1px solid #eeeeee;
}

/* Estilos del Navbar */
.navbar {
    background-color: #007bff;
    color: #fff;
    padding: 15px 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    background-image: url('imgs/header.png');
    background-size: cover;
    background-position: center;
    font-weight: bold;
    box-sizing: border-box;
    min-width: 320px;
    justify-content: space-between;
}

.menun-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
    flex-shrink: 1;
    overflow: visible;
    min-width: 0;
}

.navbar a {
    text-decoration: none;
    font-size: 18px;
    margin-left: 20px;
    margin-right: 10px;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.3s ease, text-decoration 0.3s ease;
    display: flex !important;
    align-items: center;
}

.navbar a:hover {
    text-decoration: underline;
    color: #f0f8ff;
}

.user-icon {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.animated-navbar {
    display: flex;
    flex-grow: 1;
    flex-shrink: 1;
    justify-content: flex-start;
    padding: 0 1rem;
    min-width: fit-content;
    overflow: visible;
}

.animated-navbar .nav-item {
    color: #fff;
    font-weight: bold;
    margin: 0 1rem;
    position: relative;
    transition: color 0.5s ease-in-out;
    font-size: 16px;
    padding: 5px 10px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    display: block !important;
}

.animated-navbar .nav-item::before,
.animated-navbar .nav-item::after {
    content: '';
    position: absolute;
    height: 2px;
    width: 50%;
    background-color: #0096c2;
    transition: transform 0.3s ease-in-out;
    transform: scaleX(0);
}
.animated-navbar .nav-item::before {
    bottom: 0;
    left: 50%;
    transform-origin: left;
}
.animated-navbar .nav-item::after {
    bottom: 0;
    right: 50%;
    transform-origin: right;
}
.animated-navbar .nav-item:hover {
    color: #0096c2;
    text-decoration: underline;
}
.animated-navbar .nav-item:hover::before,
.animated-navbar .nav-item:hover::after {
    transform: scaleX(1);
}

.username {
    margin-left: auto;
    margin-right: 10px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    display: block !important;
}

.logout {
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.3s ease, text-decoration 0.3s ease;
    display: block !important;
}

.logout:hover {
    text-decoration: underline;
    color: #f0f8ff;
}

/* Estilos de Formularios y Grupos de Campos (ACTUALIZADO) */
.form-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Mantenemos dos columnas */
    gap: 20px;
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
}

/* Ajuste específico para "Comments" */
#commentsContainer {
    grid-column: 1 / -1; /* Ocupa todo el ancho */
    margin-top: -10px; /* Ajusta este valor si necesitas más o menos espacio */
}


.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #555555;
    font-size: 14px;
}

.form-group input,
.form-group select,
textarea {
    padding: 10px 12px;
    border: 1px solid #cccccc;
    border-radius: 5px;
    font-size: 16px;
    color: #333333;
    background-color: #ffffff;
    box-sizing: border-box;
    width: 100%; /* Por defecto, los inputs ocupan el 100% de su form-group */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.form-group input:focus,
.form-group select:focus,
textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.groupbox {
    border: 1px solid #dddddd;
    padding: 15px 20px;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-sizing: border-box;
}

.groupbox-container {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: space-around;
    align-items: flex-start;
}

.radio-group2 {
    border: 1px solid #dddddd;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 15px;
    background-color: #f9f9f9;
    box-sizing: border-box;
}

.radio-group2 label {
    font-size: 14px;
    font-weight: 500;
    color: #555555;
    margin-bottom: 8px;
    display: block;
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
    width: auto;
}

/* Estilos de Botones */
button[type="submit"],
#AddToList,
#add-to-list,
.btnSavePTA {
    padding: 12px 25px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
    display: block;
    margin: 15px auto;
}

button[type="submit"] {
    background: linear-gradient(to bottom, #007bff 50%, #0056b3 100%);
    color: #ffffff;
    width: 250px;
}

button[type="submit"]:hover {
    background: linear-gradient(to bottom, #0056b3 50%, #003f8a 100%);
    transform: translateY(-2px);
}

#add-to-list {
    background: linear-gradient(to bottom, #1f990f 50%, #116207 100%);
    color: #ffffff;
    width: 180px;
}

#add-to-list:hover {
    background: linear-gradient(to bottom, #116207 50%, #0a3b03 100%);
    transform: translateY(-2px);
}

.btnSavePTA {
    background: linear-gradient(to bottom, #007bff 50%, #0056b3 100%);
    color: #ffffff;
    width: 250px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.btnSavePTA:hover {
    background: linear-gradient(to bottom, #0056b3 50%, #003f8a 100%);
    transform: translateY(-2px);
}

.button-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-bottom: 20px;
}

/* Estilos de Modales */
.modal, .modal3, .modal4 {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content, .modal3-content, .modal4-content {
    background-color: #fefefe;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 700px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.close-modal, .close-warning-modal3, .close-warning-modal4 {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

/* Estilos de la Sección "Add Product Details" (ACTUALIZADO) */
#pta-add {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Mantenemos dos columnas para los campos dentro de #pta-add */
    gap: 20px 30px;
    margin-top: 25px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    grid-column: 1 / -1; /* Asegura que este grid ocupe todo el ancho dentro del form-container */
}

#pta-add h3 {
    grid-column: 1 / -1;
    text-align: left;
    color: #333;
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 600;
}

#pta-add .form-group input,
#pta-add .form-group select,
#pta-add .form-group textarea {
    width: 100%; /* Mantén que los inputs ocupen el 100% de su form-group */
    box-sizing: border-box;
}

/* **AJUSTE para el campo "Remarks" (dentro de #pta-add) */
/* Anteriormente, esta regla lo forzaba a ocupar todo el ancho. La eliminamos para que se alinee con los demás campos. */
/* #pta-add .form-group:nth-of-type(8) {
    grid-column: 1 / -1;
} */
/* En su lugar, nos aseguramos de que no tenga una regla que lo fuerce a ser de ancho completo */
#pta-add .form-group:nth-of-type(8) { /* Es el 8vo form-group */
    grid-column: auto; /* Asegura que ocupe solo una columna */
}


/* **AJUSTE para el campo "Part" (dentro de #pta-add) */
#pta-add .form-group:nth-of-type(9) { /* Es el 9no form-group */
    grid-column: auto; /* Asegura que ocupe solo una columna */
}

/* Asegura que el último form-group (botón Add To List) ocupe todo el ancho */
#pta-add .form-group:last-of-type {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
}


/* Estilos para otras secciones (travel, travelcar) */
#travel, #travelcar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 25px;
    grid-column: 1 / -1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
}

/* Mensajes de Error/Éxito */
.message-box {
    grid-column: 1 / -1;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 16px;
    text-align: center;
    position: relative;
    z-index: 999;
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.message-box::after {
    content: '×';
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    color: inherit;
}

/* Contenedor de Contenido y Tablas */
.content-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

/* Estilos para la tabla dinámica de productos (ID específico) */
#product-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    margin-top: 15px;
    table-layout: fixed;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#product-table thead {
    background-color: #e9ecef;
}

#product-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    vertical-align: top;
}

#product-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
    box-sizing: border-box;
    white-space: normal;
}

#product-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#product-table tbody tr:hover {
    background-color: #e2e6ea;
    cursor: pointer;
}

/* ANCHOS ESPECÍFICOS PARA CADA COLUMNA (reajustados, si es necesario) */
#product-table th:nth-child(1), #product-table td:nth-child(1) { width: 90px; }
#product-table th:nth-child(2), #product-table td:nth-child(2) { width: 90px; }
#product-table th:nth-child(3), #product-table td:nth-child(3) { width: 90px; }
#product-table th:nth-child(4), #product-table td:nth-child(4) { width: 90px; }
#product-table th:nth-child(5), #product-table td:nth-child(5) { width: 90px; }
#product-table th:nth-child(6), #product-table td:nth-child(6) { width: 90px; }
#product-table th:nth-child(7), #product-table td:nth-child(7) { width: 90px; }
#product-table th:nth-child(8), #product-table td:nth-child(8) { width: 90px; }
#product-table th:nth-child(9), #product-table td:nth-child(9) { width: 90px; }


/* Estilo para el botón de eliminar */
#product-table .button-delete {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

#product-table .button-delete:hover {
    background-color: #c82333;
}

#product-table tbody tr:last-child td {
    border-bottom: none;
}

/* Estilos para otras tablas */
.budget-table, .table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.budget-table th, .budget-table td,
.table th, .table td {
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    text-align: left;
    font-size: 14px;
}

.budget-table th,
.table th {
    background-color: #e9ecef;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table tbody tr:hover {
    background-color: #e2e6ea;
    cursor: pointer;
}

.option-group {
    flex: 1;
    min-width: 280px;
    border: 1px solid #dddddd;
    padding: 15px 20px;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.option-group legend {
    font-weight: 600;
    margin-bottom: 10px;
    color: #555555;
    padding: 0 5px;
}

.option-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.option-item input[type="radio"] {
    margin-right: 8px;
    width: auto;
}

/* Estilos para el Dropdown (Menú desplegable) */
.dropdownDash {
    position: relative;
    display: inline-block;
    width: min-content;
}
.dropdown-contentDash {
    display: none;
    position: absolute;
    top: 30px;
    background-color: #d5d5d5;
    min-width: 160px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    padding: 12px 16px;
    z-index: 1002;
    border-radius: 15px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    left: 0;
    border: 1px solid #ccc;
}
.dropdown-contentDash #options {
    color: black;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
}
.dropdown-contentDash a:hover {
    background-color: #f1f1f1;
}

/* Estilos de Notificaciones */
.notifications {
    position: relative;
    display: inline-block;
    margin-left: 20px;
    flex-shrink: 0;
}
.notification-icon {
    height: 30px;
    cursor: pointer;
}
.notification-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: red;
    color: white;
    padding: 3px 6px;
    border-radius: 50%;
    font-size: 12px;
    display: none;
}
.notification-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    width: 300px;
    max-height: 400px;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 100;
}
.notification-panel ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.notification-panel ul li {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    color: #0723b9;
}
.notification-panel ul li:last-child {
    border-bottom: none;
}
#notificationPanel li {
    color: #0723b9;
    font-size: 14px;
    line-height: 1.5;
    list-style-type: none;
    border-bottom: 1px solid #ccc;
}
#notificationList {
    padding: 10px;
}

/* Styles for Submenu */
.submenu {
    position: absolute;
    background-color: white;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.1s ease, transform 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 30px 30px rgba(0, 0, 0, 0.2);
    z-index: 1004;
    margin-top: 5px;
    left: 0;
    transform: translateY(-10px);
    color: #007bff;
    min-width: 250px;
    box-sizing: border-box;
}
.submenu a {
    color: #333;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    text-align: left;
    display: block;
    white-space: nowrap;
    transition: background 0.3s ease, color 0.3s ease;
}
.submenu a:hover {
    background-color: #f1f1f1;
    color: #007bff;
}
.nav-item-wrapper:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Iconos */
.icon-left {
    margin-right: 10px;
}
.icon-img {
    width: 25px;
    height: 25px;
    margin-right: 10px;
    vertical-align: middle;
}

/* Animación de Navbar */
.nav-item.selected {
    color: white;
    background-color: #00a696;
}
.nav-item.active {
    color: transparent;
    background-image: linear-gradient(90deg, #53ff8e, #14bdff, #29ebff, #f936ff, #04e7ff);
    background-size: 300%;
    background-position: 100% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: slideEffect 20s ease-in-out infinite;
}

@keyframes slideEffect {
    0% {
        background-position: 100% 100%;
    }
    50% {
        background-position: 0% 100%;
    }
    100% {
        background-position: 100% 100%;
    }
}

/* Media Queries para Responsividad (ACTUALIZADO) */
@media (max-width: 1368px) {
    .navbar a {
        font-size: 17px;
    }
    .animated-navbar .nav-item {
        font-size: 15px;
        margin: 0 0.8rem;
    }
    .username, .logout {
        font-size: 15px;
        margin-left: 10px;
    }
}

@media (max-width: 992px) {
    .navbar {
        padding: 10px 15px;
    }
    .navbar a {
        font-size: 16px;
        margin-left: 15px;
        margin-right: 8px;
    }
    .animated-navbar .nav-item {
        font-size: 14px;
        margin: 0 0.5rem;
        padding: 4px 8px;
    }
    .username, .logout {
        font-size: 14px;
        margin-right: 5px;
        margin-left: 5px;
    }

    .form-container {
        grid-template-columns: 1fr; /* Una columna en pantallas pequeñas */
    }
    .form-container .form-group {
        grid-column: auto !important; /* Resetea cualquier grid-column para que todos se alineen */
    }

    /* Asegura que "Comments" siga ocupando todo el ancho en mobile */
    #commentsContainer { /* Usamos el ID para mayor especificidad */
        grid-column: 1 / -1 !important;
    }

    /* Asegura que "Ship Date" no se estire en mobile */
    .form-container .form-group #shipDate { /* Seleccionamos el input de tipo date */
        width: 100%; /* Asegura que no tenga un ancho fijo que lo haga desbordar */
    }
}

@media (max-width: 768px) {
    .main-wrapper {
        margin-top: 70px;
        width: 98%;
        padding: 10px;
    }
    h1 {
        font-size: 28px;
        text-align: center;
    }
    button[type="submit"], #AddToList, #add-to-list, .btnSavePTA {
        width: 80%;
        margin: 15px auto;
    }

    #pta-add {
        grid-template-columns: 1fr; /* Una columna en pantallas pequeñas para #pta-add */
        gap: 15px;
        padding: 15px;
    }

    /* Ajuste para mobile: Todos los form-group dentro de #pta-add ocupan el ancho completo */
    #pta-add .form-group {
        grid-column: 1 / -1 !important; /* Fuerza a ocupar todo el ancho */
    }

    #add-to-list {
        width: 180px;
        margin: 0 auto;
    }

    .groupbox-container {
        flex-direction: column;
        gap: 15px;
    }
    .option-group {
        min-width: unset;
    }

    .animated-navbar,
    .username,
    .logout {
        display: none !important;
    }

    .navbar {
        justify-content: space-between;
    }
    .navbar .logo-link {
        display: flex !important;
    }

    .mobile-menu-toggle {
        display: inline-block !important;
        background: none;
        border: none;
        font-size: 28px;
        cursor: pointer;
        color: white;
        padding: 10px;
        z-index: 1100;
        margin-left: auto;
    }
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100%;
        background: linear-gradient(to bottom, #ffffff, #f1f1f1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 15px;
        transition: left 0.3s ease-in-out;
        z-index: 1000;
    }
    .mobile-menu.show {
        left: 0;
    }
    .mobile-menu a {
        text-decoration: none;
        color: #333;
        font-weight: 500;
        font-size: 16px;
        padding: 10px 15px;
        border-radius: 6px;
        transition: background 0.2s;
    }
    .mobile-menu a:hover {
        background-color: #e0e0e0;
    }
    .close-menu {
        align-self: flex-end;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        margin-bottom: 10px;
    }
}

.mobile-menu-toggle {
    display: none;
}