/* ============================================
   style.css - ESTILO COMPLETO OPTIMIZADO
   ============================================ */

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background: #f0f2f5;
    padding-top: 56px;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: #ffffff;
    padding: 0 16px;
    height: 56px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo a {
    font-size: 28px;
    font-weight: 700;
    color: #1877f2;
    text-decoration: none;
}

.navbar .logo span {
    display: none;
}

.navbar .busqueda {
    flex: 1;
    max-width: 500px;
    margin: 0 16px;
}

.navbar .busqueda input {
    width: 100%;
    padding: 8px 16px 8px 36px;
    border-radius: 24px;
    border: none;
    background: #f0f2f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2365676b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
    background-size: 16px;
    font-size: 14px;
    transition: 0.3s;
}

.navbar .busqueda input:focus {
    outline: none;
    background-color: #ffffff;
    box-shadow: 0 0 0 1px #1877f2;
}

.navbar .usuario {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar .usuario .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}

.navbar .usuario .user-name {
    font-weight: 600;
    font-size: 14px;
    color: #050505;
}

.navbar .usuario .btn-login {
    background: #1877f2;
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.navbar .usuario .btn-login:hover {
    background: #166fe5;
}

.navbar .usuario .btn-register {
    background: #42b72a;
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.navbar .usuario .btn-register:hover {
    background: #36a420;
}

.navbar .usuario .btn-perfil {
    background: #e7f3ff;
    color: #1877f2;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.navbar .usuario .btn-perfil:hover {
    background: #d4e9ff;
}

.navbar .usuario .btn-logout {
    background: #fee;
    color: #e74c3c;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.navbar .usuario .btn-logout:hover {
    background: #fdd;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
}

/* ============================================
   FILTROS DE ORDENAMIENTO
   ============================================ */
.filtros-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filtros-container .filtro-label {
    font-size: 13px;
    color: #65676b;
    font-weight: 600;
    margin-right: 4px;
}

.filtros-container .filtro-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    background: #f0f2f5;
    color: #65676b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
}

.filtros-container .filtro-btn:hover {
    background: #e4e6e9;
}

.filtros-container .filtro-btn.active {
    background: #1877f2;
    color: white;
}

.filtros-container .filtro-btn.active:hover {
    background: #166fe5;
}

/* ============================================
   CREAR PUBLICACIÓN
   ============================================ */
.crear-publicacion {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 16px 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.crear-publicacion.invitacion {
    text-align: center;
    padding: 20px;
    color: #65676b;
    font-size: 15px;
}

.crear-publicacion.invitacion a {
    color: #1877f2;
    text-decoration: none;
    font-weight: 600;
}

.crear-publicacion.invitacion a:hover {
    text-decoration: underline;
}

.crear-publicacion .header-crear {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crear-publicacion .header-crear .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.crear-publicacion .header-crear .input-crear {
    flex: 1;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    background: #f0f2f5;
    font-size: 14px;
    color: #65676b;
    text-decoration: none;
    transition: 0.3s;
    font-weight: 500;
}

.crear-publicacion .header-crear .input-crear:hover {
    background: #e4e6e9;
}

.crear-publicacion .opciones-publicacion {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e4e6e9;
}

.crear-publicacion .opciones-publicacion .btn-opcion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 70px;
    font-size: 13px;
    font-weight: 500;
    color: #65676b;
    text-decoration: none;
}

.crear-publicacion .opciones-publicacion .btn-opcion:hover {
    background: #f0f2f5;
}

.crear-publicacion .opciones-publicacion .btn-opcion .icono {
    font-size: 18px;
}

/* ============================================
   PUBLICACIÓN - FEED
   ============================================ */
.publicacion {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 18px 10px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: 0.3s;
}

.publicacion:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.publicacion .header-pub {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
}

.publicacion .header-pub .info-usuario {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.publicacion .header-pub .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.publicacion .header-pub .nombre {
    font-weight: 600;
    color: #050505;
    font-size: 14px;
}

.publicacion .header-pub .nombre a {
    color: #050505;
    text-decoration: none;
}

.publicacion .header-pub .nombre a:hover {
    color: #1877f2;
}

.publicacion .header-pub .fecha {
    color: #65676b;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.publicacion .header-pub .views {
    color: #65676b;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 3px;
    background: #f0f2f5;
    padding: 0 8px;
    border-radius: 10px;
}

.publicacion .header-pub .categoria {
    background: #e7f3ff;
    color: #1877f2;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.publicacion .header-pub .categoria a {
    color: #1877f2;
    text-decoration: none;
}

.publicacion .header-pub .categoria a:hover {
    text-decoration: underline;
}

.publicacion .header-pub .anon-badge {
    background: #e74c3c;
    color: white;
    font-size: 8px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.publicacion .contenido {
    margin: 8px 0 0 50px;
    font-size: 15px;
    line-height: 1.6;
    color: #050505;
    word-wrap: break-word;
}

.publicacion .contenido p {
    margin-bottom: 4px;
}

.publicacion .imagen-pub {
    margin: 8px 0 0 50px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f2f5;
}

.publicacion .imagen-pub img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 400px;
    object-fit: cover;
}

/* ============================================
   LIBRO CARD
   ============================================ */
.libro-card {
    margin: 8px 0 0 50px;
    background: #f7f8fa;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 12px;
    border-left: 3px solid #1877f2;
    transition: 0.3s;
}

.libro-card:hover {
    background: #f0f2f5;
}

.libro-card .portada {
    width: 60px;
    height: 84px;
    border-radius: 4px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 9px;
    text-align: center;
    padding: 4px;
    font-weight: 700;
}

.libro-card .info-libro {
    flex: 1;
}

.libro-card .info-libro .titulo {
    font-size: 14px;
    font-weight: 600;
    color: #050505;
}

.libro-card .info-libro .autor {
    color: #65676b;
    font-size: 12px;
    margin: 2px 0;
}

.libro-card .info-libro .descripcion {
    font-size: 12px;
    color: #65676b;
    line-height: 1.4;
    margin: 4px 0;
}

.libro-card .info-libro .tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 4px 0;
}

.libro-card .info-libro .tags span {
    background: #e4e6e9;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    color: #65676b;
}

.libro-card .info-libro .acciones-libro {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.libro-card .info-libro .acciones-libro button {
    padding: 4px 12px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 11px;
    transition: 0.3s;
}

.libro-card .info-libro .acciones-libro .btn-valorar {
    background: #f7b928;
    color: #050505;
}

.libro-card .info-libro .acciones-libro .btn-valorar:hover {
    background: #f5b00a;
}

.libro-card .info-libro .acciones-libro .btn-recomendar {
    background: #1877f2;
    color: white;
}

.libro-card .info-libro .acciones-libro .btn-recomendar:hover {
    background: #166fe5;
}

.libro-card .info-libro .acciones-libro .btn-recomendar.recomendado {
    background: #42b72a;
}

.libro-stats {
    display: flex;
    gap: 16px;
    color: #65676b;
    font-size: 12px;
    padding: 6px 0;
    border-top: 1px solid #e4e6e9;
    border-bottom: 1px solid #e4e6e9;
    margin: 8px 0 0 50px;
    flex-wrap: wrap;
}

.libro-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.libro-stats .promedio {
    color: #f7b928;
    font-weight: 600;
}

.libro-stats .recomendaciones {
    color: #42b72a;
    font-weight: 600;
}

/* ============================================
   ACCIONES - FEED
   ============================================ */
.publicacion .acciones {
    display: flex;
    justify-content: space-around;
    padding: 4px 0;
    border-top: 1px solid #e4e6e9;
    margin: 6px 0 0 0;
}

.publicacion .acciones button {
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #65676b;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.publicacion .acciones button:hover {
    background: #f0f2f5;
}

.publicacion .acciones .like-btn.liked {
    color: #1877f2;
}

.publicacion .acciones .like-btn.liked:hover {
    background: #e7f3ff;
}

.publicacion .acciones .btn-eliminar {
    color: #e74c3c;
}

.publicacion .acciones .btn-eliminar:hover {
    background: #fee;
}

/* ============================================
   COMENTARIOS
   ============================================ */
.publicacion .comentarios {
    margin-top: 8px;
}

.publicacion .comentarios .comentario {
    display: flex;
    gap: 10px;
    margin: 8px 0;
}

.publicacion .comentarios .comentario .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.publicacion .comentarios .comentario .bubble {
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    flex: 1;
}

.publicacion .comentarios .comentario .bubble .nombre-com {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 2px;
}

.publicacion .comentarios .comentario .bubble .nombre-com .anon-badge-com {
    background: #e74c3c;
    color: white;
    font-size: 8px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
    margin-left: 4px;
}

.publicacion .comentarios .comentario .bubble .texto-com {
    font-size: 14px;
    color: #050505;
    word-wrap: break-word;
}

.publicacion .comentarios .comentario .bubble .fecha-com {
    font-size: 10px;
    color: #65676b;
    margin-left: 4px;
    font-weight: normal;
}

.publicacion .comentarios .escribir-com {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.publicacion .comentarios .escribir-com.invitacion {
    justify-content: center;
    padding: 4px 0;
}

.publicacion .comentarios .escribir-com.invitacion p {
    font-size: 13px;
    color: #65676b;
}

.publicacion .comentarios .escribir-com.invitacion a {
    color: #1877f2;
    text-decoration: none;
    font-weight: 600;
}

.publicacion .comentarios .escribir-com.invitacion a:hover {
    text-decoration: underline;
}

.publicacion .comentarios .escribir-com .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.publicacion .comentarios .escribir-com input {
    flex: 1;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    background: #f0f2f5;
    font-size: 14px;
    transition: 0.3s;
}

.publicacion .comentarios .escribir-com input:focus {
    outline: none;
    background: #ffffff;
    box-shadow: 0 0 0 1px #1877f2;
}

.publicacion .comentarios .escribir-com .btn-enviar {
    background: #1877f2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: 0.3s;
}

.publicacion .comentarios .escribir-com .btn-enviar:hover {
    background: #166fe5;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination .disabled {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    text-decoration: none;
    font-size: 13px;
    color: #65676b;
    transition: 0.3s;
    background: #ffffff;
    font-weight: 500;
}

.pagination a:hover {
    background: #f0f2f5;
    color: #1877f2;
}

.pagination .active {
    background: #1877f2;
    color: white;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: default;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: #ffffff;
    padding: 24px 20px 12px;
    margin-top: 24px;
    border-top: 1px solid #e4e6e9;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}

.footer-col h4 {
    color: #050505;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.footer-col p {
    color: #65676b;
    font-size: 13px;
    line-height: 1.6;
}

.footer-col a {
    display: block;
    color: #65676b;
    text-decoration: none;
    font-size: 13px;
    padding: 3px 0;
    transition: 0.3s;
}

.footer-col a:hover {
    color: #1877f2;
}

.footer-bottom {
    text-align: center;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #e4e6e9;
    color: #65676b;
    font-size: 12px;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    animation: slideUp 0.3s ease;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
}

.toast.success {
    background: #42b72a;
}

.toast.error {
    background: #e74c3c;
}

.toast.info {
    background: #1877f2;
}

.toast.warning {
    background: #f7b928;
    color: #050505;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .navbar {
        padding: 0 12px;
    }

    .navbar .busqueda {
        display: none;
    }

    .navbar .logo a {
        font-size: 22px;
    }

    .navbar .usuario .user-name {
        display: none;
    }

    .navbar .usuario .btn-perfil,
    .navbar .usuario .btn-logout,
    .navbar .usuario .btn-login,
    .navbar .usuario .btn-register {
        font-size: 12px;
        padding: 4px 10px;
    }

    .container {
        padding: 8px;
    }

    .publicacion {
        padding: 10px 12px 6px;
    }

    .publicacion .header-pub .categoria {
        font-size: 10px;
        padding: 1px 8px;
    }

    .publicacion .contenido {
        margin-left: 0;
        font-size: 14px;
        margin-top: 8px;
    }

    .publicacion .imagen-pub {
        margin-left: 0;
    }

    .libro-card {
        margin-left: 0;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .libro-card .portada {
        width: 80px;
        height: 112px;
    }

    .libro-card .info-libro .acciones-libro {
        justify-content: center;
    }

    .libro-stats {
        margin-left: 0;
    }

    .publicacion .acciones {
        justify-content: space-around;
    }

    .publicacion .acciones button {
        font-size: 12px;
        padding: 4px 8px;
    }

    .crear-publicacion .opciones-publicacion .btn-opcion span {
        display: none;
    }

    .crear-publicacion .opciones-publicacion .btn-opcion {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        font-size: 12px;
        padding: 6px 8px;
    }

    .filtros-container {
        padding: 10px 12px;
        gap: 6px;
    }

    .filtros-container .filtro-btn {
        font-size: 12px;
        padding: 4px 10px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .navbar .usuario .btn-perfil,
    .navbar .usuario .btn-logout,
    .navbar .usuario .btn-login,
    .navbar .usuario .btn-register {
        font-size: 11px;
        padding: 4px 8px;
    }

    .navbar .logo a {
        font-size: 20px;
    }

    .publicacion .acciones button {
        font-size: 11px;
        padding: 4px 6px;
    }

    .filtros-container .filtro-btn {
        font-size: 11px;
        padding: 3px 8px;
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 18px;
    color: #050505;
    margin-bottom: 6px;
}

.empty-state p {
    color: #65676b;
    font-size: 14px;
    margin-bottom: 16px;
}

.btn-primary {
    display: inline-block;
    padding: 10px 24px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background: #166fe5;
}