/* === ESTILOS ACTUALIZADOS === */


html,body {
    font-family: 'Segoe UI', sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    color: black;
}

button {
    height: 40px;
    border: none;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    cursor: pointer;
}

button[type="submit"] {
    background-color: #3498db;
    /* Celeste */
    color: white;
}

button[type="submit"]:hover {
    background-color: #2980b9;
}

button[type="agregar"] {
    background-color: #2980b9;
    color: white;
}

button[type="button"] {
    background-color: #e0e0e0;
    color: #333;
}

button[type="button"]:hover {
    background-color: #d5d5d5;
}

.eliminar-btn {
    height: fit-content;
    background-color: rgba(231, 76, 60, 0.5);
    color: #c74c3c;
    transition: transform 0.3s ease;
}

.eliminar-btn:hover {
    background-color: #ffc9c9;
    transform: scale(1.05);
}
/*-------------*/
/*----LOGIN----*/
/*-------------*/

/* === ESTILOS PARA LOGIN - COHERENTE CON SISTEMA ACTUAL === */
#login-form {
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-width: 100vw;
    background-color: #f8f9fa;
    margin: 0;
    box-sizing: border-box;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    border: 1px solid #e0e0e0;
}

.login-container h2 {
    color: #343a40;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.login-container input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.login-container button {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.login-container button:hover {
    background-color: #2980b9;
}

.error-message {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    display: none;
}


/*SPINER*/
/* styles.css */
.spinner-container {
    position: relative;
    flex-grow: 1;
    min-height: 300px;
}

.spinner-wrapper {
    position: fixed;
    /* Cambiamos a fixed para que sea relativo al viewport */
    top: 50%;
    /* Centramos verticalmente */
    left: 50%;
    /* Centramos horizontalmente */
    transform: translate(-50%, -50%);
    /* Ajuste fino del centrado */
    z-index: 100;

}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 99;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    animation: spin 1s linear infinite;
    position: relative;
    z-index: 100;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.container {
    display: flex;
    margin: 0 auto;
}

.tabs {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 190px;
    /* mismo ancho que ya tenías */
    background-color: #343a40;
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
}


.tab-btn {
    width: 80%;
    padding: 10px 15px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    text-align: start;
}

.tab-btn.active {
    border-bottom-color: #0d6efd;
    font-weight: bold;
}

#btn-logout {
    margin-top: auto;
    /* Empuja el botón al fondo de .tabs */
    margin-bottom: 20px;
    /* Agrega un pequeño espacio en la parte inferior */

}

.pantalla {
    flex-grow: 1;
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 1px solid #444;
    margin-left: 190px;
    /* igual al ancho de .tabs */
}

/*---------------------*/
/* BUSCADOR */
/*---------------------*/
.buscador-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: fit-content;
}

.buscador-container input {
    width: 60%;
    padding: 10px;
    font-size: 1em;
    border-radius: 4px;
    border: #9e9e9e 1px solid;
}

.buscador-container select {
    width: 15%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    color: white;
    color: black;
}

#verificarStock {
    padding: 10px;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: black;
    border: #9e9e9e 1px solid;
}

.btn-nuevo img {
    width: 40px;
    height: 40px;
}

.btn-nuevo {
    background-color: #f8f9fa;
    height: fit-content;
}




/*---------------------*/
/* TABLA */
/*---------------------*/
#productos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;

}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #dcdcdc;
    font-weight: bold;
}

tr:hover {
    background-color: #d2d2d2;
    cursor: pointer;
}

tr.clicked {
    background-color: rgba(0, 120, 215, 0.1);
    transition: background-color 0.3s;
}

/* Evita selección de texto durante doble click */
tr {
    user-select: none;
}

.sin-stock {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    font-weight: bold;
}

.bajo-stock {
    background-color: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    font-weight: bold;
}

.en-stock {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
}

.modal-content {
    background-color: #f8f9fa;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 50%;
    max-width: 500px;
    height: fit-content;
    max-height: 80vh;
    color: #333333;
    /* Texto más oscuro */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.close-modal {
    float: right;
    font-size: 40px;
    cursor: pointer;
}

#producto-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.form-group{
    width: 99%;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 1em;
    color: #555;
}

.form-group input {
    width: 99%;
    border: 1px solid #646464;
    border-radius: 4px;
    padding: 8px;
    font-size: 1em;
    background-color: #f9f9f9;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;

}

/*-------------------------*/
/* EXTRACCIONES */
/*-------------------------*/

.agregar-producto-container {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.search-wrapper {
    width: 70%;
    display: flex;
    flex-direction: column;
}

#search-input,
#search-input-ingreso {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.suggestions-container {
    position: absolute;
    width: 43%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.cantidad-container {
    width: 20%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cantidad-container input {
    width: 70%;
    padding: 10px;
    font-size: 1em;
    border-radius: 4px;
    border: #9e9e9e 1px solid;
}

.form-actions-btns {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.table-modal-extraccion{
    margin-top: 5px;
    overflow-x: hidden;
    height: fit-content;
    max-height: 250px;
    overflow-y: scroll;
}
/* Estilos para los iconos SVG en botones */
.btn-eliminar-producto svg,
.btn-eliminar-producto-ingreso svg,
.eliminar-btn svg {
    width: 16px;
    height: 16px;
    stroke: #e74c3c;
    fill: none;
}

.btn-editar-cantidad svg,
.btn-editar-cantidad-ingreso svg {
    width: 16px;
    height: 16px;
    fill: #3498db;
}


/* Centrar iconos en botones */
.btn-eliminar-producto,
.btn-eliminar-producto-ingreso,
.btn-editar-cantidad,
.btn-editar-cantidad-ingreso {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 35px;
    padding: 8px 12px;
    margin: 0 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    transition: all 0.2s ease;
}

.btn-editar-cantidad,
.btn-editar-cantidad-ingreso{
    margin-top: 10px;
}

.btn-eliminar-producto:hover,
.btn-eliminar-producto-ingreso:hover {
    background-color: #ffebee;
    border-color: #e74c3c;
}

.btn-editar-cantidad:hover,
.btn-editar-cantidad-ingreso:hover {
    background-color: #e3f2fd;
    border-color: #3498db;
}
/*-------------------------*/
/* INGRESOS */
/*-------------------------*/


.table-modal-ingreso {
    margin-top: 20px;
    overflow-x: hidden;
    height: fit-content;
    max-height: 250px;
    overflow-y: scroll;
}

#ingresos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#ingresos-table th,
#ingresos-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#ingresos-table th {
    background-color: #dcdcdc;
    font-weight: bold;
}


@media (max-width: 800px) {
    body {
        font-size: 14px;
        width: 99vw;
    }
    /* Contenedor principal */
    .container {
        flex-direction: column;
        height: 100vh;
    }

    /* Tabs - versión horizontal */
    .tabs {
        position: fixed;
        top: 0;
        left: 0;
        height: 10vh;
        width: 100vw;
        background-color: #343a40;
        color: white;
        z-index: 1000;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 10px 5px;
        gap: 0;
    }

    .tabs h2 {
        display: none;
    }

    .tab-btn {
        flex: 1;
        padding: 5px;
        margin: 0;
        background: none;
        border: none;
        color: white;
        cursor: pointer;
        font-size: 0.75rem;
        border-bottom: 3px solid transparent;
        border-left: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .tab-btn.active {
        border-bottom-color: #0d6efd;
        font-weight: bold;
    }

    .tab-btn i {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }

    #btn-logout {
        margin-top: 0;
        margin-bottom: 0;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        border-bottom: none;
    }

    #btn-logout span {
        display: none;
    }
    /* Pantalla principal */
    .pantalla {
        margin-left: 0;
        padding: 15px;
        border-left: none;
        margin-top: 15vh;
        max-width: 100%;
    }

    #productos-table th:nth-child(2),
    #productos-table th:nth-child(3),
    #productos-table th:nth-child(5),
    #productos-table td:nth-child(2),
    #productos-table td:nth-child(3),
    #productos-table td:nth-child(5),
    #extracciones-table th:nth-child(3),
    #extracciones-table td:nth-child(3),
    #extracciones-table th:nth-child(4),
    #extracciones-table td:nth-child(4) {
        display: none;
    }

    .table-modal-extraccion table th:nth-child(3),
    .table-modal-extraccion table td:nth-child(3),
    .table-modal-ingreso table th:nth-child(3),
    .table-modal-ingreso table td:nth-child(3) {
        display: none;
    }

    .table-modal-extraccion,
    .table-modal-ingreso {
        max-height: 350px;
    }

    #productos-tab,
    #extracciones-table {
        max-width: 100%;
        overflow-x: auto;
        
    }

    #productos-tab table,
    #extracciones-table table,
    #ingresos-table table {
        table-layout: fixed;
        width: 100%;
    }

    #productos-tab th,
    #productos-tab td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: center;
    }

    #modal-title,
    .close-modal {
        display: none;
    }

    .modal-content {
        width: 70vw;
        height: fit-content;
        max-height: 90vh;
    }

    #extraccion-descripcion-container{
        width: 95%;
    }


    #producto-form {
        width: 90%;
    }

    .search-container{
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .suggestions-container{
        width: 70%;
    }
    .search-wrapper{
        width: 100%;
    }
    .cantidad-container{
        justify-content: space-around;
        width: 100%;
    }

    .form-actions {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .form-actions-btns {
        width: fit-content;
    }

    #btn-eliminar-producto {
        display: none !important;
    }

    #producto-cantidad {
        width: 30px;
    }

    #btn-agregar-producto {
        width: fit-content;
        padding: 10px 5px;
    }

    


}
/* Responsive */
@media (max-width: 480px) {
    .login-form{
        max-width: 100vw;
    }
    
    .login-container {
        padding: 30px 20px;
        margin: 0 15px;
    }
    
    .login-container h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .login-container input,
    .login-container button {
        padding: 10px;
        font-size: 14px;
    }
    .modal-content{
        max-height: 85vh;
    }
    .table-modal-extraccion{
        max-height: 400px;
    }
    .table-modal-ingreso {
        max-height: 450px;
    }

}
