.tags-container {
    margin-top: 5px;
}

.tags-input-wrapper {
    position: relative;
}

.tags-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.tags-input-group input[type="text"] {
    flex: 1;
    padding: 10px 40px 10px 10px; /* Más padding a la derecha para el botón */
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    margin-top: 0;
}

.add-tag-button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #1976d2;
    color: white;
    border: 1px solid #1976d2;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.add-tag-button:disabled {
    background: #f5f5f5;
    border-color: #ddd;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
    transform: translateY(-50%);
}

.add-tag-button:not(:disabled):hover {
    background: #1565c0;
    border-color: #1565c0;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.add-tag-button:not(:disabled):active {
    background: #0d47a1;
    border-color: #0d47a1;
    transform: translateY(-50%) scale(0.95);
}

.add-tag-button:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Responsive styles for mobile */
@media (max-width: 768px) {
    .tags-input-group input[type="text"] {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 44px 12px 12px; /* Más padding para el botón en mobile */
    }
    
    .add-tag-button {
        width: 36px;
        height: 36px;
        font-size: 20px;
        right: 4px;
    }
    
    .tags-help {
        font-size: 0.75em;
        line-height: 1.4;
    }
    
    .tag {
        font-size: 0.9em;
        padding: 6px 10px;
    }
    
    .tag-remove {
        width: 20px;
        height: 20px;
        font-size: 1.1em;
    }
}

/* Fallback para cuando no hay grupo de input (mantener compatibilidad) */
.tags-input-wrapper input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    margin-top: 0;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    min-height: 20px;
}

.tag {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 500;
    border: 1px solid #bbdefb;
    transition: all 0.2s ease;
}

.tag::before {
    content: '#';
    color: #90caf9;
    font-weight: bold;
    margin-right: 2px;
}

.tag:hover {
    background: #bbdefb;
    border-color: #90caf9;
}

.tag-remove {
    background: none;
    border: none;
    color: #1976d2;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    margin-left: 4px;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.tag-remove:hover {
    background: #1976d2;
    color: white;
}

.tags-help {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-top: 4px;
}

/* Estilos para mostrar tags en la vista de libro */
.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.book-tag {
    display: inline-block;
    background: #f5f5f5;
    color: #333;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    border: 1px solid #e0e0e0;
    text-decoration: none;
    transition: all 0.2s ease;
}

.book-tag::before {
    content: '#';
    color: #999;
    font-weight: bold;
    margin-right: 1px;
}

.book-tag:hover {
    background: #e0e0e0;
    color: #000;
    text-decoration: none;
}

.book-tag-more {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7em;
    border: 1px solid #ddd;
}

/* Estilos para búsqueda por tags */
.tags-search {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.tags-search .tag {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.tags-search .tag:hover {
    background: #0056b3;
}

.tags-search .tag-remove {
    color: white;
}

.tags-search .tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
} 