/* General */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-image: url('/static/img/background.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
}

/* Contenedor Principal */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Título */
h1 {
    text-align: center;
    color: #eb6abe;
    font-size: 28px;
    margin-bottom: 20px;
}

/* Tabla de Libros */
.item-list {
    overflow-x: auto;
    /* Agrega desplazamiento horizontal */
}

.item-list table {
    width: 100%;
    table-layout: auto;
    /* Permite ajuste dinámico */
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 16px;
    min-width: 700px;
    /* Ancho mínimo para evitar que se encoja */
}

.item-list th,
.item-list td {
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
    word-wrap: break-word;
}

.item-list td img {
    width: 80px;
    height: auto;
    border-radius: 5px;
    margin: 0 auto;
    display: block;
}

/* Acciones */
.stock-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.stock-quantity {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    padding: 10px;
}

.stock-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.stock-actions .btn.add {
    background-color: #846aeb;
    color: white;
}

.stock-actions .btn.subtract {
    background-color: #d96aeb;
    color: white;
}

.stock-actions .btn:hover {
    transform: scale(1.1);
}

/* Botones de Acción */
.actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    color: white;
    transition: background 0.3s;
}

.actions .btn.edit {
    background: #846aeb;
}

.actions .btn.delete {
    background: #d96aeb;
}

.actions .btn:hover {
    opacity: 0.8;
}

/* Navbar Styles */
.navbar {
    background-color: #eb6abe;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    justify-content: space-between;
}

.navbar-logo {
    font-size: 20px;
    color: white;
    text-decoration: none;
    font-weight: bold;
}

.navbar-links {
    display: flex;
    gap: 15px;
}

.navbar-links a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    padding: 8px 12px;
    transition: background-color 0.3s ease;
    border-radius: 5px;
}

.navbar-links a:hover {
    background-color: #6a79eb;
}

.navbar-toggle {
    display: none;
    font-size: 24px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
}

/* Landing Page */
.landing-container {
    text-align: center;
    padding: 50px 20px;
    color: #333;
}

.landing-title {
    font-size: 36px;
    color: #6a79eb;
    margin-bottom: 10px;
}

.landing-subtitle {
    font-size: 18px;
    color: #ae6aeb;
    margin-bottom: 30px;
}

.categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 10px;
    width: 250px;
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 10px;
}

.category-card h3 {
    font-size: 20px;
    color: #846aeb;
    margin: 0;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.category-card:hover h3 {
    color: #d96aeb;
}



/* Botón Flotante */
.floating-add-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #d3b8eb;
    color: white;
    font-size: 36px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    transition: transform 0.3s, background-color 0.3s;
    z-index: 1000;
}

.floating-add-button:hover {
    background-color: #6a79eb;
    transform: scale(1.1);
}

.floating-add-button:active {
    background-color: #6a79eb;
    transform: scale(0.95);
}


/* Fila de stock agotado */
.item-row.out-of-stock {
    background-color: #f8d7da;
    /* Fondo rojo claro */
    color: #721c24;
    /* Texto rojo oscuro */
    font-weight: bold;
    /* Resalta el texto */
}

.item-row.out-of-stock a {
    color: #721c24;
    /* Cambia el color de los enlaces */
}

.item-row.out-of-stock img {
    opacity: 0.6;
    /* Reduce la opacidad de la imagen */
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination a {
    margin: 0 5px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #eb6abe;
    transition: background 0.3s;
}

.pagination a.active {
    background: #eb6abe;
    color: white;
    font-weight: bold;
}

.pagination a:hover {
    background: #ae6aeb;
    color: white;
}

/* Responsividad */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 15px;
    }

    h1 {
        font-size: 24px;
    }

    .navbar-links {
        display: none;
        flex-direction: column;
        width: 100%;
        text-align: center;
        background-color: #6a79eb;
        position: absolute;
        top: 100%;
        left: 0;
    }

    .navbar-links.active {
        display: flex;
    }

    .navbar-toggle {
        display: block;
    }

    .item-list table {
        font-size: 14px;
    }

    .item-list th:nth-child(3),
    /* Selecciona la columna "Nombre" */
    .item-list td:nth-child(3) {
        width: 20%;
        /* Reduce el ancho de la columna */
        max-width: 150px;
        /* Máximo ancho permitido */
        overflow: hidden;
        text-overflow: ellipsis;
        /* Agrega puntos suspensivos si el texto es largo */
        white-space: nowrap;
        /* Evita que el texto se divida en varias líneas */
    }

    .item-list th,
    .item-list td {
        padding: 8px;
        /* Reduce el espacio entre las celdas */
        font-size: 12px;
        /* Ajusta el tamaño del texto */
    }

    .item-list td img {
        width: 100px;
        /* Aumenta el tamaño de las imágenes para mejor visibilidad en tablets */
        min-height: 100px;
        object-fit: cover;
    }

    .actions .btn {
        font-size: 12px;
        padding: 4px 6px;
        /* Botones más compactos */
    }

    .stock-actions .btn {
        width: 20px;
        /* Botones circulares más pequeños */
        height: 30px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 20px;
    }

    .item-list th,
    .item-list td {
        padding: 6px;
        /* Reduce aún más el espacio en celdas */
        font-size: 10px;
        /* Texto más pequeño */
    }

    .item-list td img {
        width: 80px;
        /* Imágenes más grandes en móviles para mejor visibilidad */
        min-height: 80px;
        object-fit: cover;
    }

    .actions .btn {
        font-size: 10px;
        padding: 3px 5px;
        /* Botones más pequeños */
    }

    .stock-actions .btn {
        width: 20px;
        /* Botones circulares más pequeños */
        height: 28px;
        font-size: 12px;
    }

    .floating-add-button {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}

/* Contenedor principal de métricas */
.stock-metrics {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* Tarjeta individual */
.metric-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    width: 200px;
    font-weight: bold;
}

/* Animación hover */
.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Estilo del título */
.metric-title {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
}

/* Estilo del número */
.metric-value {
    font-size: 28px;
    font-weight: bold;
}

/* Colores personalizados */
.metric-card.total {
    border-left: 6px solid #6a9ceb;
}

.metric-card.in-stock {
    border-left: 6px solid #6aeb7f;
}

.metric-card.out-of-stock {
    border-left: 6px solid #eb6a6a;
}

/* 📌 Responsive para celulares */
@media (max-width: 768px) {
    .stock-metrics {
        flex-wrap: nowrap; /* Mantiene las tarjetas en una fila */
        gap: 8px; /* Reduce el espacio entre tarjetas */
        justify-content: center; /* Centra las tarjetas en la pantalla */
        padding: 0 10px; /* Agrega un pequeño margen lateral para evitar que choquen */
    }

    .metric-card {
        flex: 1;
        min-width: 90px; /* Reduce el tamaño mínimo */
        max-width: 100px; /* Ajusta el ancho máximo para que entren las 3 */
        padding: 8px; /* Reduce el padding interno */
        font-size: 14px; /* Ajusta el tamaño del texto */
    }

    .metric-title {
        font-size: 11px; /* Texto más compacto */
    }

    .metric-value {
        font-size: 18px; /* Tamaño más pequeño del número */
    }
}

